Ghosting in Animation Projects

We are on Unit 3 Lesson 27, making our final project. When students are trying to move a sprite say right to left, it is a leaving a copy of that sprite. For example, there is a mario pipe sprite and they are doing pip.velocityx = -5. The pipe moves left but it leaves a copy of itself. What is the fix for this?


Good afternoon! The behavior you are seeing will happen if you don’t have a background block inside the draw loop. The way the draw loop works is that it redraws the screen every time through the loop. If there is a background block inside the draw loop, it draws a new background over the top of the old sprite before it moves to a new location and this achieves the desired effect of “flipbook style animation.”

If you are still running into problems after adding the background block, reach back out and send us a “share” link to your code and we are happy to look at it.