Hello! Could I please have some help?

So I am working on a game like dodge ball but how do I make it so when the ball hits a wall it resets into it position it was first in? This is currently what I have for the code.

2 Likes

use an an extractor with first position and a position block

also welcome

Thanks! I`ll try that.

I dont really understand what you mean because Im a little new, could you maybe give me a screen shot of the code or just explain a little more?

What???This is confusing.

So you’re wanting the ball to return to a certain point of the map after it hits a wall right? If you do, hover your mouse over the grid space where the ball currently starts in. If should say something like 21/4 (sorry I looked up your game so I can have a better understanding of what you need.) All coordinates in flowlab are X,Y so 21 is the X location and 4 is the Y. So upon collins into the wall you could add it going into two numbers (X,Y) and then into a position set block so it will reset the bullet back to its original position. The thing is, is that the position only uses coordinates based on pixels not grid. Since every grid space is 32 pixels you will have to multiply 21/4 by 32 and you will get 672,128 pixels. So add each number to the equivalent value and plug them into the position.
Here’s a screen shot for this if you got confused:


And I can tell that the game doesn’t prove much difficult if the bullet is always in one location, so you could try fidgeting with the random behavior and try to get it to randomly generate along the Y coordinate. (You would want to keep X. Here’s a screenshot:

So now the bullet will randomly generate along the Y axis so it will give the player much of a choice to move up and down. Although no sure if this is what you want, but while I was at it I figured that I would give some ideas.

Also I kind of knew what @edwardi meant, but I can agree he didn’t explain it enough for someone who doesn’t know much about some of the behaviors so i just kinda simplified it for you. Although you technically don’t need to use the extractor block, but there are are many other ways of solving this issue so I figured that I would do the most easiest one that I know.

Ok thanks! I`ll tell you if it works.

Yes it works!! Thanks so much!

3 Likes