×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    23

    how to give a realistic fall when a player fall?

    hi all

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


    thanks in advance

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2007
    Posts
    915

    Re: how to give a realistic fall when a player fall?

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

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    23

    Re: how to give a realistic fall when a player fall?

    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

  4. #4
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Bournemouth, UK
    Posts
    65

    Re: how to give a realistic fall when a player fall?

    please read the thread parabolic movement, it will give you an idea of how to implement such physics
    Made With Caffiene And Sleepless Nights

  5. #5
    Registered User
    Join Date
    Aug 2008
    Posts
    23

    Re: how to give a realistic fall when a player fall?

    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. #6
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: how to give a realistic fall when a player fall?

    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

Similar Threads

  1. 6280 camera capture - no image returned?
    By neomedia in forum Mobile Java Media (Graphics & Sounds)
    Replies: 10
    Last Post: 2006-11-20, 13:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×