Please help with some debugging on student projects

My students are making a side scroller game. They have a player that jumps to avoid an obstacle (that makes health go down) and try to touch a target (that makes the score go up).

I have analyzed the code for both of these and had students help scour the code for errors. We are not finding any. I may be overlooking something simple.

In this game, the present and coffin should move from right to left and loop back around at random heights. You will see that sometimes it dances around when it comes back to the right. Can you find what I am missing?

In this one, the salad and the rock should loop as they reach the left side. The salad tends to dance around. Again, I am not seeing an error in the code. I thought it may be because she drew her own sprites, but I replaced her sprites with sprites from the library and it still happened.

Thank you in advance for your keen eyes!
Tracey

Hi @tlong,

Those are two fun games!

In the first game, take a look at line 61 and 62. It is the same as lines 54 and 55. It is also the reason the target doesn’t reset when it hits the player:)

In the second game, it is working well but the sprites are huge because the size includes a great deal of white space around the sprite. This fix requires that you crop all your sprites so that their collidable area includes only the sprite itself and not empty white space (or gray space in the animation tab) around the sprite. All you need to do is select each sprite on the left and then click on the crop button image.

Good luck!
~Michelle

You are a genius! Thank you so much for the help!