# 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.

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.

@Reverie Clive?