draw circles from x y of actor to x y of mouse


  • Posts: 139

I've been trying to create a "bullet firing" behaviour to throw a ball. I want to use the position of the mouse to be used for the power and the angle between the actor and mouse to be the angle to throw the ball - I've read about LERP but am struggling to put together something that draws concentric circles from the starting position to the mouse position.

Thanks in advance for any help!


  • *
  • Posts: 2682
You can use a line equation between your two points, then use a loop block with the number of circles you want between the points and draw them. For the angle, use the atan2 block between the two points, and power could be something based on the pythagorean theorem.

In my Combat Pack, including in the demo version, there's a behavior called Raycast that does something like the circle drawing in its debugging options, if you want to take a look how the code can look: https://luyren.itch.io/luyren-ai-and-combat-pack

And I'll just leave this here in case there are any issues related to positioning and spacing when drawing: https://youtu.be/diMrZg95Oqw
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.


  • Posts: 139
Thanks again for your help and advice, I pulled apart the raycast behaviour to make the circles appear from the actor and then used the forums to find the distance and angle to fire the ball from the actor. The ball fired too fast so I tweaked it a little to divide the distance by 3. Here is the code for anyone else who is interested.