Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / firework spinner effect

Author
Message
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 23rd Nov 2012 11:15
Is there an easy way to make a physics sprite act as if it was like a spinning firecracker?

So its angle would cycle through 0 to 360 and push like it had propulsion?

Or could someone at least tell me how it could be done?
Would I use SetSpritePhysicsImpulse?

Ive been trying to use SetSpritePhysicsImpulse but I don't think I am getting the force to push it properly...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Nov 2012 12:52
Yes, just apply an angular velocity and a linear velocity based on its current angle:



this.mess = abs(sin(times#))
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 24th Nov 2012 08:27
Wow!
That is so sweet, Thanks much for that!

Now I just gotta figure out what is happening...

heheh
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Nov 2012 08:38
If you ignore the sparks it's relatively simple. Just use sin() and cos() and the angle of the sprite to work out your linear forces.


this.mess = abs(sin(times#))
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 24th Nov 2012 10:53
I see that it is still not very friendly to a percentage based coordinate system.
It is pretty reliant on subtle balances to get it spinning properly.
In the percentage based system the particles you created actually help to balance out the twirling.

Any easy way to limit the speed of the spin?

ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 24th Nov 2012 11:10 Edited at: 24th Nov 2012 11:31
Oops think I narrowed in on it...

not sure about the particles coming out of the center instead of the end of the stick now though...



can't for the life of me figure out how to get the particles to come out of the top end of the stick.

Login to post a reply

Server time is: 2024-05-05 18:08:14
Your offset time is: 2024-05-05 18:08:14