ActionScript 2.0 - Basic Platformer

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
16,342
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 28, 2008

Here's me programming a basic platformer in AS2. :) And due to MiniGameMan asking so kindly, here's the code in the description for you to Copy-and-Paste and edit, so you can learn for yourself! :D

onClipEvent(load)
{
speed = 5;
gravity = 0;
r = _height / 2;
jumping = false;
jumpheight = 10;
}

onClipEvent(enterFrame)
{
if(Key.isDown(Key.RIGHT))
{
_x += speed;
}

if(Key.isDown(Key.LEFT))
{
_x -= speed;
}

if(Key.isDown(Key.UP) && !jumping)
{
gravity = -jumpheight;
jumping = true;
}

if(!_root.ground.hitTest(_x, _y, true))
{
gravity++;
_y += gravity;
} else
{
jumping = false;
gravity = 0;
}

while(_root.ground.hitTest(_x, _y - 1 + r, true))
{
jumping = false;
_y--;
}
}

  • likes, 7 dislikes

Link to this comment:

Share to:

Uploader Comments (PieManTheHero)

  • This video is a favorite on Chad

  • @octaviocurti922 on Chad?

  • Could you have the code copied down in the description for the ball so it will be easy to use. :) Thanks

  • @MiniGameMan Done ;) Just for you

  • i thought a platformer with hill climbing would have really complicated code, but you showed me how simple it is

  • @pengro7 I used to think that aswell :)

see all

All Comments (149)

Sign In or Sign Up now to post a comment!
  • @croser81 got it -.- forgot to name the INSTANCE ground not only the movieclip.

  • Now tell me.. why does my circle just fall trough the ground? I named the movieclip ground and the circle player and just copy/pasted the code.

  • Dude thanks! I just needed the code for the ground so the char wont run on the whole symbol

    Like for this!

  • Your vid went viral on Ukraine

  • wow respekt man, voila hehe ;) nice one point for you. ciao

  • Awesome!

  • @GPepicness From Adobe. It's Adobe Flash Professional.

  • where can i get this program?

Loading...

Alert icon
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