Big Ali is PacMan – Sony Music (2011)

Flash game on Facebook. Gameplay of the original PacMan with a 3D isometric view.
Game design, level design, Flash development, ActionScript 3.

Garden Rush

Garden Rush – MesmoGames (2011)

Flash game on Facebook. Time management game.
Développement Flash, ActionScript 3.

ActionScript: Move an object with keyboard with camera relative control

In this tip I will show you how to move an object with keyboard with camera relative control.

What is a camera relative control?

The direction of your object will be calculated depending the camera position. (Mario 64, Uncharted, GTA 3, etc.).
Eg: If press the right button the character will go on the right.

How to make a camera relative control?

  • Get the arrow key status (key is up/key is down)
  • Set the direction vector
  • Move the object on enter frame with the direction vector


Donwload source: www.benoitfreslon.com-Move-an-objet-with-keyboard-with-camera-relative-control.zip

ActionScript: Move an object to coordinates with smoothing

There is a simple formula to move an object to coordinates with smoothing.
The speed will decrease with smooth during the time.

speed = distance_between_objects / smoothing

The distance will decrease because the distance will decrease too.

If I set values I got:

object.x = 50
targetX = 100

speedX = (targetX – object.x) / 5

On the first frame: speed = 10
object.x += (100 – 50) /5 > 50/5 > 10
>
object.x = 50+10 = 60

On the second frame: speed = 8
object.x += (100 – 60) /5 > 40/5 = 8
>
object.x = 60 + 8 = 68

On the third frame: speed = 6,4
object.x += (100 – 68) / 5 > 32/5 = 6,4
>
object.x = 68 + 6,4 = 74,4

etc.

On the 100th frame: speed = 0
object.x += (100 – 100) / 5 > 0 /5 = 0
> object.x = 100 + 0 = 100

Source:

Exemple:

Download source: www.benoitfreslon.com Move an object to coordinates with smoothing.zip

ActionScript: Launch a function after a delay with setTimeout

There are different ways to launch a function after a delay:

  • With the enter frame event;
  • With the Timer class;
  • With a motion tween;
  • With the enter frame event and the getTimer() method;
  • And with the setTimeout function (See setTimeout help on Adobe);

How to master the setTimeout ?

  • First of all you must create a variable assigned to the setTimeout identifier;

  • The setTimeout function returns an identifier (uint) when you call this function. Save this identifier into the assigned variable;

  • This identifier must be clear with the clearTimeout function in order to stop the setTimeout;

NB:

  • If you want to launch a setInterval already launched don’t forget to clear the previous setInterval. In witch case the previous setInterval won’t be stopped;
  • The setTimeout function can’t be paused or resumed;
  • Assign one variable by one setTimout;
  • The setTimeout function is based on clock time not on frames time;
  • When you clear the setTimeout the closure function is not launched;
  • You don’t have to clear the setTimeout when the setTimeout is already finished;

Add parameters

The setTimeout function can receive one or several arguments. Those arguments are passed to the closure function.
To add arguments just add your arguments after the second parameter into the setTimeout function:
Obviously your closure function must have the same number of arguments.

Exemple:

Download source: www.benoitfreslon.com Launch a function after a delay with setTimeout.zip

Geek Is Art

GeekIsArt – ISART Digital (2010)

Puzzle game made with Flash, developed for the ISART DIGITAL School.
Game design, level design, Flash development, ActionScript 3, sound design.

Take Something Literally 2

Take Something Literally 2 (2010)

Flash game, compilation of creative puzzles. Play with all your devices and your browser.
Game design, level design, Flash development, ActionScript 3, sound design.

Awards: 15M plays.

Décroche la lune

Décroche la lune – HR-Path (2010)

Flash game developed for the HR-Path website.
Game design, level design, Flash development, ActionScript 3, sound design.

The hand of Thierry Henry

La main de Thierry Henry le jeu (2009)

Newsgame developed with Flash in 10h during the “Hand of the Thierry Henry” crisis  in 2010.
Game design, level design, Flash development, ActionScript 3.

Take Something Literally

Take Something Literally (2009)

Flash game, creative puzzle compilation games.
Game design, level design, sound design, Flash development, ActionScript 3.

Awards: 75M plays.