ActionScript: Move object with smooth acceleration and deceleration with inertia

Today a simple sample of code to create an inertia effect in ActionScript 3.0.

The character will start to move with smooth acceleration if you press an arrow key.

You can download the source code here :

ActionScript: Tutorial How to create a gravity like a Mario platformer

In this little tutorial you will learn how to create a gravity like a Mario platformer.

Let’s start!

Get files

  • Save these 2 sprites (Right click > Save as)

  • Open Flash and create a new ActionScript 3.0 document.
  • Document properties: 24 fps, 550×400 by default.

Create the Hero MovieClip

  • Create a new Symbol: Insert > New symbol > MovieClip
  • Symbol name: Hero
  • Check Export for ActionScript
  • And Click OK

  • Now you are in you Hero symbol! Perfect!
  • Import the first sprite: mario_stand.png on the first frame:
  • File > Import > Import to stage > mario_stand.png
  • Set the sprite just on the top of the little black cross (pivot point)
  • Now create an empty keyframe on the timeline:
  • Timeline > 2nd frame on the timeline > Right Click > Create empty Keyframe
  • Import the second sprite: mario_jump.jpg on the second keyframe
  • Then create a new layer on the top and set 2 labels names
  • Insert > Timeline > New layer
  • And add 2 labels names:
  • On the timeline click on the first key frame with the mario_stand.png sprite and go to the Properties pannel > Label > Name > stand
  • On the timeline click on the second key frame with the mario_jump.png sprite and go to the Properties pannel > Label > Name > jump

Add the jump script

  • Back to the main scene: Click on the Scene 1
  • Add a new layer named “Actions”: Insert > Timeline > New layer
  • And open the Actions pannel: Timeline > Actions Layer > Keyframe > Right click > Actions
  • Finally copy and paste this code:

Download sources: www.benoitfreslon.com_Create_gravity_like_a_mario_plateformer

Flash with GPU 3D acceleration – Max Racer with p2p multiplayer

An amazing Real Time 3D rendering with multiplayer p2p.
This is not Unity or 3D via player but Flash player with AlternativaPlatform version 8.
Flash is rendering this in 60fps running 1920×1080. Very impressive!
You will be able to get your hands on this API in the first half of 2011.