Unit 3, Lesson 20, bubble 4

[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]

Link to the project or level: Code.org - Game Lab
**What I expect to happen:**line 50 has the code for the ‘player’ to move up when the up key is pressed - I would expect the player to move up the screen continually
What actually happens: The player moves up once. It seems to be acting like “keyWentDown” instead of “keyDown”
What I’ve tried: deleting the code and re-entering it, refreshing the browser, comparing it to other code written that works as expected.

Hello @ltucker , I looked at your code, but I guess I’m not seeing the problem. The dog goes up with the up key. I didn’t see any code to make it go down. It seems to be working as expected unless I’m reading your expectations incorrectly.

1 Like

Her code to make it go down is at lines 56-7

The code at lines 50-51 should cause the dog to go up with a vel of 2 but it will only do it while the up key is being held down. I have the exact same code (with a different player name) in the one I did on my own and it goes up with a vel of 2 as soon as I hit the up key… I’m not sure what’s going on - I don’t think it’s her code, I think it’s her gamelab (?)

@ltucker,

Line 45 is the line that is causing the issue you are seeing. The dog’s y value starts at 300 and with each click of the up key, it gets even smaller. As a result, line 45 is always in play and unless you are clicking on the up key, the velocityY of the dog is set to 0.

Hope this helps!

Mike

Thanks - I just found it before I logged into my email - wish I’d have read this first!