Need list of commands for unit 3 lesson 22

One of my student is being rather creative, but that has resulted in some complications re: what code to use for the various actions in her game.

In space, she has a star, a planet, and a space ship. Here are a few of the things she wants to do, and my question is where is there a list of commands that she can look up to find the code she needs?

Example:

The space ship moves horizontally from left to right. If you click on the planet (no matter where the space ship is), the space ship shrinks in size and moves toward the planet. When the space ship gets there, the screen zooms in to a closeup of the planet’s surface. The space ship lands and some aliens get out.

I had the student list all the things she wanted her sprites and other objects in the scene to do. Now she has to figure out the code, and she’s not sure what the commands are (neither am I!).

Thank you very much for your help!

Gary Ellis
Creekside Middle School
Castro Valley, CA

Been there done that. I like when students start to get creative, but it isn’t always easy to help the students when they know their projects better than we do! There is probably more than 1 way to accomplish any of those tasks, but maybe if you want to point them in a general direction, it will involved a conditional block (or more than one). To involve the mouse, you will need a world block or two. You will also need to change sprite properties. See one example below … This function would be called from the draw loop (so it would continuously run) and it would check to see if the mouse is clicking on the planet and then would change the size of the spaceship, point the spaceship to the planet and move it towards the planet.

Note, this code is just a quick throw together and hasn’t been tested by me, but that’s where I would start. As far as zooming, there are camera commands such as camera.zoom (among others) that could help.

Some of the commands aren’t visible from unit 3, lesson 22, so to access the blocks, she would need to remix her project which would put it in the projects library and open all the commands.

I would suggest she do that and then start looking at and experimenting with the different commands and seeing if she can make some of it work. Then, if she gets stuck, you could send us a link to her project (after she shares it) and we could give you some suggestions.

You can see all of the commands along with explanations of how they work and examples of them in use here: https://docs.code.org/gamelab/

I hope this is at least a starting point for exploration…

Mike

1 Like

That’s brilliant, Mike! I’ll check it out tomorrow. I haven’t remixed projects before, so we’ll see how it goes.

Thanks again!

Gary