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 / Physics question...

Author
Message
gbison
13
Years of Service
User Offline
Joined: 15th Dec 2010
Location: USA
Posted: 14th Nov 2012 03:31
Hello all,

I might just be overlooking things but does AppGameKit have a method for applying force to an object based on the angle? Say for example I wanted to use physics to control a player ship. I want the propulsion to be physics driven within AppGameKit using force. This force is applied appropriately on the object based on the angle the object is pointing effectively allowing the player to just press forward and then left and right as needed for direction change.

Again my apologies if this is somewhere Im overlooking, been a long day

"The greatest trick the devil ever pulled, was to convince the world he didn't exist."
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Nov 2012 09:16 Edited at: 14th Nov 2012 09:17
Yes, look at the setSpritePhysicsForce and setSpritePhysicsImpulse commands. I would guess the second suits your needs more.

If you want to apply a force based on your sprite angle then use something like:


You may need to add or take away some factor of 90.0 to your sprite angle depending on what angle the 'ship' is at in the image.


this.mess = abs(sin(times#))
2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 14th Nov 2012 14:20
Would that type of physics work for lets say a motorcycle? Also, would it be possible to have it set that if parts of the sprite collide with anything it sends the player back to the last checkpoint.

Cheers.

God help me, Please.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Nov 2012 14:54
You'd be better using motors for a motorcycle but theoretically yes that would work.

Checking for contacts and collisions can certainly be used the way you are thinking.


this.mess = abs(sin(times#))
gbison
13
Years of Service
User Offline
Joined: 15th Dec 2010
Location: USA
Posted: 15th Nov 2012 04:53
@baxslash

Much appreciated!

"The greatest trick the devil ever pulled, was to convince the world he didn't exist."

Login to post a reply

Server time is: 2024-11-24 01:18:32
Your offset time is: 2024-11-24 01:18:32