donderdag 31 maart 2011

Researching player character Jumping.

I am searching the Internet trying to find information on how to let my rectangle jump in a java applet.

Until now I read that you should not use more then one timer.


boolean jumping:
long startTime;
 if(keyJump )
   long jumpTime=System.currentTimeMillis()-startTime;
  //update player jump

Above is a little snippet that I found. It does not work if you compile it with java but shows that you can use System.currentTimeMillis() for getting timing that you can use to smoothly animate a jump.

I just found I found it before but I forgot about it. I found a game that has jumping in it and am about to look through it. I am also looking through the other games to see if there is anything useful in it. The sourcecode suplied with the games can be pasted into the java editor.

Update :
I spend a hour or so trying to find a simple applet gravity bouncing ball/object but I could not find anything. I am now trying to find information on timers.

Geen opmerkingen:

Een reactie posten