Game Lab colored stripe


I don’t know why the bee and plane are not moving without leaving a strange coloured strip behind them - like their shape is cutting a hole in the background color.
I copied the code from lesson 9.4 which plays ok and pasted it into this Gamelab project, changing sprites to bee and creating a bee and plane sprites.

Hi Glen!

Your links just take me to the home page for studio.code.org, however, what it sounds like to me is that your background block isn’t inside the draw loop. The way animation works is for the entire screen to be redrawn over and over with a slight change (the bee’s x or y value) each time. In order for the semblance of animation to happen, the background also has to be redrawn each time, so it needs to be inside the draw loop.

If that’s not it, please see if you can click the share button (or remix first and then share) and send the link from there.

Best wishes!

Mike

Hi Mike,
Thanks for reaching out to me with your assistance. You are correct the background color is not in the draw loop. However, I have the background color and also have a rectangle with fill color as well to give the effect of a sky. The background was created in a previous lesson and I used it when I got to the animation unit. I’d greatly appreciate it if you could take a look at it.

https://studio.code.org/projects/gamelab/IK60b1JEOH-Av3IBwKVBN_Adk5d8pgMOqfY32tpH9Ok

I’m not sure if I reply here through this email or through the forum so I’ll try both.

Kind regards,

Glen.

Also the bee doesn’t move anymore. I’d like to build upon it as I learn more if it’s possible.
Cheers,
Glen.

@glen.strickland Very nice job on your drawing and animation. I like the layered effect with the blue and the green backgrounds.

So, even though your background is more than just a single background block, all of the components of the background need to move inside the draw loop. When you do this, it will redraw them each time it updates the sprite properties and it will give you your desired effect.

Also, another thing that will help is only using one draw loop and one “draw sprites” block. I think that’s why your bee wasn’t moving. It wasn’t executing all three draw loops for some reason. When I moved all of your drawing code into the first draw loop and moved all of your sprite creation code to before the draw loop and all of the sprite update code into that draw loop, it all seemed to work.

Here’s the version I remixed if you want to take a look.

Remixed Game

best wishes!

Mike

Thanks for your help and I’ve learnt a lot by studying how you have structured the code. I’m looking forward to adding to this animation and creating another one.
Kindest regards,
Glen.

2 Likes