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
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 4th Jul 2012 21:09
Hi guys,
Because I have not experience in physics programming in general, I am in need for some guides on how to create a sprite that will serve as a soccer ball, looking at from top view, and will interact with four walls they will serve as bumping limits.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jul 2012 22:13
Look at the SimpleBox2D example in Projects\Basic\Examples\Physics for a Tier 1 example that shows you some things you can do.

The Tier 2 example is 'Box2D - SimpleBox2D'.

My WIP uses physics very nicely. It's great to just set up some objects and get something moving and then not worry about the interactions (unless you want to). Things bounce about very nicely without any help.

Cheers,
Ancient Lady
AGK Community Tester
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 4th Jul 2012 22:45
Thank you Ancient Lady for your response. Before my question, I took a look in the physics examples, but all of these have the 'gravity' in consideration by default (I don't need gravity at all). I am sure that I will find my way but I asked just for saving time.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Jul 2012 23:08
For top down games just set the gravity to zero using setPhysicsGravity(0,0) and give sprites some damping so they slow down over time using setSpritePhysicsDamping()


this.mess = abs(sin(times#))
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jul 2012 23:38
baxslash beat me to it!

Another command to use with SetSpritePhysicsDamping is SetSpritePhysicsRestitution. That one sets the bounciness.

Cheers,
Ancient Lady
AGK Community Tester
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 5th Jul 2012 03:37
thank you both of you
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Jul 2012 13:37
I would also set an angular damping value so your ball doesn't spin endlessly


this.mess = abs(sin(times#))
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jul 2012 18:07
Awww, isn't spinning good?

Cheers,
Ancient Lady
AGK Community Tester
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Jul 2012 18:43
Only after a few




this.mess = abs(sin(times#))

Login to post a reply

Server time is: 2024-05-04 07:00:16
Your offset time is: 2024-05-04 07:00:16