Unit 3 Lesson 17 help with code

My student wants his sprites to rotate continuously when the space bar is pressed but it is not doing that.

I just tried the app and it seems to be working. I tried both arrows. In each case, I kept the right and left arrows pressed until the “present” popped up. Is he expecting a different behavior?

He wants the dog and penguin to rotate continuously and they are not. They appear and when you press the space it rotates once and stops.

Hi. I see that there are two warnings in the code in lines, lines 65 and 66. I think he needs to create “Penguinzo” and “Dog” as global.

I am new to teaching this class. When you say global, what is that and how is it done? Thank you so much for your help.

I remixed it and worked on your app. Please, let me know if this is what you wanted.
I made it so only in the case both pets are out of the present, they will rotate.

I created all of the sprites at the top of the code (outside the if statements and therefore global - they can be accessed anywhere in the code-). The dog and penguin sprite are not visible when the program starts running.

I also got rid of two variables/sprites that I think were not necessary. I am talking about Doggo and Penguinzo1. I think the only reason the student had to create them is because he was using Dog and Penguinzo as local variables. He had created Dog and Penguinzo inside an if statement, and they could not be accessed from a different if statement.

I do not use the Discoveries curriculum, (I am teaching Principles) but if Dog and Penguinzo are variables, shouldn’t the students use lowercase?

RemixProject

1 Like

Yes! Thank you so much!

Hi, there. I just changed a few more things: placed the commands to set up the scale of the Penguinzo and Dog sprites on top of the code, and deleted an extra draw Sprites();

Use the same link.

1 Like