Gravity and Physics in Java 2 ME

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Gravity and Physics in Java 2 ME

Postby SameHendx » Thu Aug 04, 2011 6:34 am

Hy everibody! I'm creating game with balls and I have a problem with gravity and physics. How to create it ?
SameHendx
 
Posts: 3
Joined: Thu Aug 04, 2011 6:17 am

Re: Gravity and Physics in Java 2 ME

Postby DevelopmentTeam » Fri Aug 05, 2011 5:08 am

Its easier to bring gravity simulation into you game. However, the best solution is Box2D or other Java based physics engines.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: Gravity and Physics in Java 2 ME

Postby SameHendx » Fri Aug 05, 2011 6:13 am

Thanks, but where I can get Box2D
SameHendx
 
Posts: 3
Joined: Thu Aug 04, 2011 6:17 am

Re: Gravity and Physics in Java 2 ME

Postby DevelopmentTeam » Fri Aug 05, 2011 11:32 am

You have lots of other Physics engine that are ported to J2ME. Just do a google "j2ME Physics engine"
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: Gravity and Physics in Java 2 ME

Postby SameHendx » Mon Aug 08, 2011 6:00 am

It's easy with physcis engines but I want to myself good physsics
SameHendx
 
Posts: 3
Joined: Thu Aug 04, 2011 6:17 am

Re: Gravity and Physics in Java 2 ME

Postby DevelopmentTeam » Tue Aug 16, 2011 4:48 am

The simplest way to simulate physics for objects...

All objects will have (int) x, y, (float) forcex, forcey

Calculations for each frame:
object[i].x += forcex;
object[i].y += forcey;
object[i].forcex -= 0.5; (you can alter this 0.5 to your preference)
object[i].forcey -= 0.5; (you can alter this 0.5 to your preference)
object[i].y -= gravity; (Tune this gravity to make it look realistic)
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 2 guests

cron