Incorporating games into event driven programming

I’m teaching a hybrid course combining CSD and CSP in a single year. My students completed CSD Unit 3 Lesson 22 (Designing a Game) back in December-January. The video in CSP, Unit 5, Chapter 1, Lesson 1(~6 minutes 10 seconds into the video) implies that students can setScreen to the jumper game they coded in CSD Unit 3. My students are intrigued. How can this be achieved? How does one use the setScreen to reference a URL (copied from the “Share” feature in their jumper game) rather than a screen id, or is this accomplished in some other way?

Then the question is how does one activate the keyDown() commands if students are playing a game on their smartphone and don’t have access to a full keyboard? Most of my students just use the Left,Right, and Up arrows to control the jumper in their games.

Perhaps the video demonstrated a feature that is possible but was beyond the scope of this CSP unit but many students have asked how they can accomplish this.

Thanks!

Hi @gershon.ari,

Unfortunately I don’t think that this is possible. In the video, they are showing a lot of little clips of different apps that code.org staff have created in app lab and I think the staff member re-created some of the logic from gamelab in app lab. Clicking on the button didn’t actually change the screen - they just cut to a different app clip.

As far as I know, there isn’t a way to “set screen” to a page outside of app lab, however because app lab is a web-app, you can choose to leave the app and go to a new page using the open() function. You can see this at work here: App Lab - Code.org

I also don’t know of a way of activating “key down” on the phone without making the keyboard pop up. The work-around that I have seen from students is to create a button with an arrow on it for each direction and to use the click event.

More generally, there are a few forum discussions that talk about the relationship between App Lab and Game Lab. Fundamentally they are different: App Lab is driven by events and sequential code, while Game Lab relies on the draw loop. You can coerce App Lab into doing animations using the timedLoop() block but in general you’ll just not have the same set of tools designed around animation unless you go over to Game Lab. Here are two posts that might be useful in students’ quest towards animation:

Good luck!
Madeline