hi all
how to give a realistic feeling when the player going to fall from a height ?
thanks in advance
hi all
how to give a realistic feeling when the player going to fall from a height ?
thanks in advance
Use the sleep(). By using sleep method you can make the execution slowewr and redraw image in paint()
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
thanks for the reply yaar
please read the thread parabolic movement, it will give you an idea of how to implement such physics
Made With Caffiene And Sleepless Nights
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;
}
}
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