# Thread: how to give a realistic fall when a player fall?

1. hi all

how to give a realistic feeling when the player going to fall from a height ?

2. Use the sleep(). By using sleep method you can make the execution slowewr and redraw image in paint()

3. hi

its ok will it give a reakistic feeling .. i know this way i an searching for any other way like using any physics or any other technique

4. please read the thread parabolic movement, it will give you an idea of how to implement such physics

5. how to calculate next postion using this rooosone?

private void movePlayer()
{

//for(player1CurrentCol=0;player1CurrentCol< 10;player1CurrentCol++ ){

currentPosition=sampleMap[player1CurrentRow][player1CurrentCol+1];
//player1CurrentCol +=1;

System.out.println("currpos>>>>>>>>>>>>>>>>>>>>>>>>>>"+currentPosition);
switch(currentPosition){
case -1:
break;
case 0:
clnX +=1;
break;
case 1:
clnX +=1;
clnY -=1;

break;
case 2:
clnX +=1;
clnY +=1;
break;

}

}

6. Well, if the player falling means something like falling from a clif... Then parabolic movement might be an overkill.

From physics class I can still remember that in linear movement x(t)=1/2*a*t^2+v0*t (or something along those lines...)

Where
a = acceleration (in this case g)
t is time
v0 is initial speed (=0)

For game purposes you can forget using the exact g

So the y position can be calculated at time t being
y = A * t*t (where A is a suitable constant, which makes the fall happen with ok speed on the screen)

You should be able to come up with your exact solution based on this information (unless of course I answered something else than you were really looking for...)

Hartti

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.