dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Jumping.

  1. #1
    Member
    Join Date
    Oct 2006
    Location
    Australia
    Posts
    56

    Jumping.

    Hey guys/girls.

    This is probably really simple but im having a realy hard time to get it to work

    I want to make a pretty basic game where there is a guy running around .etc but i cant get him to jump. ive got th up key set to make the vy -= 4 and it makes him fly. ive tried an if to see if he is on an object but that still doesnt work very well.

    If you have the solution please help

    Thanks in advance

  2. #2
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    Please try the following code:
    //______________________________________________
    var p=0;
    sprite.onEnterFrame=function(){
    sprite._x+=5;
    if(sprite._x>600){
    sprite._x=25;
    }
    if (Key.isDown(Key.UP)) {
    p+=0.2;
    sprite._y=235-50*Math.sin(p);
    if(sprite._y>235)sprite._y=235;
    }else{
    sprite._y=235;
    p=0;
    }
    }
    //_____________________________________________
    Also please see the attached movie developed in FLASH 8.
    Last edited by Eager Beaver; 08-19-2007 at 02:22 PM.
    <signature removed by admin>

  3. #3
    Member
    Join Date
    Oct 2006
    Location
    Australia
    Posts
    56
    Thanks.

    I ended up playing around with an if statement and got it working

    Thanks anyway

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center