My student has a double character trailing when the character is going left, I don’t have the double character showing in the screenshot but it shows up going left but not right …does anyone have a solution to stop the double trailing
Hi, can you link to the code so that we can debug it?
I don’t understand why there are three separate sprites for the “kid” character. There is a kid sprite, a kid_left sprite, and a kid_right sprite. I think you should just have one kid sprite, and get rid of the other two. That’s the major problem.
The reason the two characters are showing up is because when you push down the left key, the program is setting the kid_sprite’s visible property to true. The kid sprite is still visible, so you see two characters. The same thing happens when you press the right key (kid_right is now visible, as well as kid), but NOT having the left key down sets the visible property to false again (the
else part of that conditional). If you press BOTH the left and right keys, you can see all three sprites.
In other words, the main problem is that you have three sprites when you should only have one, but you’re only seeing the problem sometimes because of the order of the conditionals and how you are using them.
Thank you, it’s been solved!