Stop bouncing on a block

I am confusion now.

1 Like

Try it. What position does on the square does it go to?

3 Likes

If I do a “Set Position to x (((Square)Width) / 2))” then it is across to the left side of the screen

1 Like

What if you add that to the square’s x position? THen what?

If I am on the right side, then if it bumps it would just back the player out of the block which is what I want. If I go to the left side, it just teleport’s me to the right side of the square, but not touching it. :+1:

How would you make it bump you out the left side, if adding the width goes to the right?

1 Like

Subtracting makes the more sense. But if I subtract it it will just go off screen to the left side of the screen.

Why will it do that?

1 Like

If the block is gonna be “Set position to x, (((Square) Width / 2) - (Self) X Position)”. Then this is my prediction why it could do that.
When it is The frogs set position, we will be looking at the “(Square) Width / 2”, that will make it go to the center of the block(I’m pretty sure/most likely), but with the subtraction of the x position it would go all the way to the left position of the screen. Because of the “X Position” of the frog being subtracted from the squares width. So if Frogs X position is 490, then it would be something like 37.5(half of the square’s width) - 490, making it go all the way to the left side. Don’t know if I’m right but it’s the best I can think of it going that way.

But “Set position to x, (((Square) Width / 2) + (Self) X position” works so that is what I am questioning right now. It should go to the right side of the screen because of that, but instead hits the right side of the block…

OH, wait I think it’s because it makes the number negative going to the other side of the screen making the equation negative, instead of positive SO… I have to use a Absolute value. oH my gosh i finally accomplished something…

Now since I have completed the side bumps, I need to create a “Check Once If” block so once it hits the right or left side of the block it will do that function. I’ma try finding it myself for now… if I can’t then I’ma need some assist points from you.

1 Like

Also, I’m surprised this is the only Topic on “Debug my Code” that is actually still a kinda alive.

@telletubies should we Clive this topic?

what!? wow.