Unit 3 Lesson 20 Bubble 2

Two problems:

1 - student wants sprite to go up (all the way) when she presses the key. She has instructions for the sprite to descend at Y=100. When the sprite descends, the sprite goes past Y=400. I inserted the code about stopping the sprite at Y= 360, but I’m not sure if that was the most efficient way of doing it (wondering if I needed to nest IF statements).

2 - Code works on my computer, but not when students runs it. We’re confused.

Thank you!

Gary

Link to the project or level: [replace with link to the curriculum or get the “Share” link to a project]
What I expect to happen: [replace with a detailed description of the behavior you’re trying to create]
What actually happens: [replace with a detailed description of what actually happens when the code runs including any errors or unexpected behavior]
What I’ve tried: [replace with a detailed description of what you’ve already tried to do to solve the problem]

I think you answered your question about why the sprite doesn’t go all the way up - because the student has code for it to descend when frog.y is less than 100. It goes as high as frog.y being 100 and then the velocity is changed and it descends. Have you tried changing the number in the “If frog.y <100” statement?

It worked on my computer too. I’m not sure why it would work on one computer and not another, unless the code wasn’t changed. If that continues to be a problem just on that student’s account/computer that would be a question for support@code.org

Often there is more than one way to solve a problem in coding. You did it, you solved it and it worked the way you wanted it to. Problem solved :slight_smile:

Thank you very much - as it happened, it worked on the student’s computer today!

Gary

2 Likes