Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Flash 8 Tutorial - How to make a platform game advance - Part 1

Loading...

Sign in or sign up now!
64,195
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Oct 1, 2009

ActionScript Codes:

Character:

onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 0;
var gravity:Number = 2;
var speed:Number = 7;
var maxJump:Number = -12;
var touchingGround:Boolean = false;
}
onClipEvent (enterFrame) {
_y += grav;
grav += gravity;
while (ground.hitTest(_x, _y, true)) {
_y -= gravity;
grav = 0;
}
if (ground.hitTest(_x, _y+5, true)) {
touchingGround = true;
} else {
touchingGround = false;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.UP) && touchingGround) {
grav = maxJump;
}
if (ground.hitTest(_x+(_width/2), _y-(_height/2), true)) {
_x -= speed;
}
if (ground.hitTest(_x-(_width/2), _y-(_height/2), true)) {
_x += speed;
}
if (ground.hitTest(_x, _y-(height), true)) {
grav = 3;
}
}
_________________________
- Flash8Games

Category:

Howto & Style

Tags:

License:

Standard YouTube License

Link to this comment:

Share to:

Top Comments

  • Thank you

    Everyone that can't do it: Make sure your instance name is "ground"

    Thumbs up so people can see

  • @marthak2

    Either you:

    1. Didn't give the character an instance name of "char".

    2. Didn't give the ground an instance name of "ground".

    3. For the character didn't put the registration point in the bottom-middle.

Video Responses

This video is a response to Flash: Make a Platform Racing Game PART 2
see all

All Comments (456)

Sign In or Sign Up now to post a comment!
  • Man I love u Flash8Games!!! :)

  • grax

  • how do u open the option for instance name ????/

  • as soon as i heard music i clicked out :>

  • CAN SOMEONE HELP ME

    the things at left where u color with are gone

  • How do I make walls?

    

  • @ervinasroblox3 I cald it ground it still keeps falling through!!!

    

  • Pls help....ive entered the actionscript on my mac yet when i click test movie nothing moves in the window tht poped up. It appears as " Platfrom game-1.swf". What should i do?

View all Comments »
Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more