How can I have a sprite spiral towards the center image point if another sprite in collision?
Is there a way to set an orbit with ever decreasing radius?
Think of it like something spiraling into the center of a whirlpool.
You can use the trig formula:
SpriteB.X= SpriteA.X +cos(angle)*distance
SpriteB.Y= SpriteA.Y +sin(angle)*distance
You would have a variable for the angle 0 to 360, and a variable for the distance that is getting smaller.
Thanks for the reply. How would I apply those formulas, using Orbit?
Develop games in your browser. Powerful, performant & highly capable.
dropbox.com/s/e6ksqccp3d4dn10/spiral.c3p
You could but its kind of pointless.
Thanks! This is helpful.
How do i make it speed up as it gets closer to the center instead of slowing down?
Redownload I added a variable for acceleration.
Thank you very much newt. This gives me something to work with and fine tune it. I really appreciate the quick replies and example files. You're awesome.
sorry to bother you again, but I am trying to get the sprite to move in the spiral when the sprite with bullet behavior collides with the other sprite. I can't seem to get that work.it just passes right through the other sprite and never triggers the spiral motion. I don't get what I'm missing.
Re download.
I think that's what you mean.
Thanks for the quick reply. The Dropbox link is broken. It says "link not found."
"https://www.dropbox.com/s/f5pt6efo60b4vk7/spiral.c3p?dl=1"
Looks like the forum is doing something weird with the links.
This is great. Thank you.
I made a view modifications to get it to behave how it will in my game, but now I can't figure out how to get the spiral speed to match the bullet speed once it collides with the big circle. Check it out:
https://www.dropbox.com/s/y2fnzy6vxc9mz8g/spiral%20%281%29%20EDIT.c3p?dl=0
I'm guessing you would set Sprite2.acc to the absolute of the bullet speed.
abs(Sprite2.Bullet.Speed)
Here's the alternate version with the Orbit Behaviour.
https://www.sizzle-games.com/spiral(orbit).c3p
I'm guessing you would set Sprite2.acc to the absolute of the bullet speed. abs(Sprite2.Bullet.Speed)
that works perfectly. thank you. But then how do I get it to increase speed over time as it spirals?