Sprite doesn't appear

I have a transfer that until now has been using scratch to code. I am not familiar with scratch, but it looks like most of his skills have transferred. I can’t figure out why the ball sprite won’t show up here. I appreciate any help.

Link to the project or level: (Game Lab - Code.org)
What I expect to happen: The Ball sprite should appear at 150,150.
What actually happens: The Ball sprite will not appear when the program is run.
What I’ve tried: Rearranging the order of the code. I think there is a problem with the layering, but I wasn’t able to figure out exactly where.

jfranksa.sh,

Welcome to the forum!

That was a tricky one. The problem is a combination of a few things. What is happening is that the ball starts at (150, 150), but before you can even see it, it moves to 1313, 150 (which is off screen).

It is moving due to a collision with the players, the walls and due to the size of the ball.

The ball is huge… you can’t see it to tell that, but it is very large. I changed the scale to .2 and it may need to be smaller, however, the scale needs to be implemented when the sprite is created. In this case, it’s not even changed until after the collision takes place (bounce blocks). So, right after making it, try changing it’s scale to .2 or smaller.

Next, if you look at the wall animation in the animation tab, you will see that on both the left and right side of the animation, there are a lot of empty pixels. Even though they’re not visible, they’re part of the animation and the code that tells the ball to bounce off the wall is causing the ball to bounce off the “empty pixels.”

One solution would be to use a rectangle instead of an image for the walls. Another solution would be to edit the animation and remove the blank space. There is a crop sprite button (5th button down on the right side) that will remove the blank pixels. After that, they will need to change where the wall is created as removing the blank pixels could cause a shift.

I think if you change the scale (right after creating it) and delete the blank space around the walls and reposition them, you should be able to see the ball again and make other necessary adjustments as needed.

Good luck!

Mike

1 Like

Thank you so much! I was completely befuddled, but this makes sense.