MP3 site Music shop Billy Talent Carcass Bjork Pitbull MP3 search Ozzy Osbourne Music database Steve Perry Pink Floyd

Side Scrolling Fish Swim Game with APE Physics Engine


In an effort to find a very simple and easy to use physics engine we stumbled upon APE. Although this is not the most powerful of Flash physics engines it does seem to have a rather minimal learning curve.

There are several other physics engines in AS3 available. The one that seems to currently be the leader of the pack is Box2D. Box2D is a port from C++ so package names / method names etc do not follow Actionscript best practices (lowercase package names & uppercase method names). Not really a big deal but a little odd at times.

For this game it seemed that APE had plenty of features and power to get the desired result.

Monsters (fish), and coins were easily placed in an array
var monsters:Array = [ { x:1500, y:150, type:Starfish }, { x:1700, y:300, type:Octo }, { x:2500, y:180, type:Starfish },
{ x:2700, y:330, type:Octo }, { x:3200, y:150, type:Starfish }, { x:3700, y:300, type:Octo }, { x:3900, y:180, type:Starfish },
{ x:4000, y:330, type:Octo }, { x:4300, y:300, type:Octo }, { x:4500, y:180, type:Starfish }, { x:5000, y:330, type:Octo },
{ x:5500, y:150, type:Starfish }, { x:6000, y:300, type:Octo }, { x:6200, y:180, type:Starfish }, { x:6700, y:330, type:Octo },
{ x:7000, y:120, type:Starfish }, { x:7700, y:350, type:Octo }, { x:8300, y:180, type:Starfish }, { x:9000, y:330, type:Octo },
{ x:9300, y:300, type:Octo }, { x:9800, y:180, type:Starfish }, { x:10000, y:330, type:Octo },

{ x:1600, y:220, type:Coin }, { x:1900, y:220, type:Coin }, { x:2200, y:220, type:Coin },
{ x:3500, y:220, type:Coin }, { x:3800, y:220, type:Coin }, { x:4600, y:220, type:Coin },
{ x:9600, y:220, type:Coin }, { x:11000, y:220, type:Coin }, { x:12000, y:220, type:Coin }


Movement is as simple as adding force to an object:
protected function onKeyDown(evt:KeyboardEvent):void

if (evt.keyCode == Keyboard.UP)
forceAmountY = -25;
if (evt.keyCode == Keyboard.DOWN)
forceAmountY = 25;
if (evt.keyCode == Keyboard.RIGHT)
forceAmount = 6;
if (evt.keyCode == Keyboard.LEFT)
forceAmount = -6;

All together the creation of this game was not difficult. With some more time spent on adding sounds, animations to monsters, and general fluff you would have a sweet fun game.

If you or your clients need any help, feel free to contact our interactive agency.

4 responses so far, want to say something?

  1. linkfeedr » Blog Archive » Side Scrolling Fish Swim Game with APE Physics Engine - RSS Indexer (beta) says:

    […] with APE Physics Engine VA:F [1.1.8_518]Rating: 0.0/5 (0 votes cast) This article was found on . Click here to visit the full article on the original website.In an effort to find a very simple and easy to use physics engine we stumbled upon APE. Although […]

  2. Off Topic : Creating a simple game with APE Physics Engine at Papervision 3D Tutorials says:

    […] View full blog entry […]

  3. Flash Speaks ActionScript Community » Blog Archive » A Simple Fish Swim Game with APE Physics Engine says:

    […] hasn’t seen much light but looks to provide some good possibilities.В  Check out this simple fish swim game which uses the ActionScript Physics […]

  4. Tim Oxley says:

    Hey that’s pretty cool but are you going to publish the rest of the source, as this doesn’t really show how you used APE to actually set up the objects…

Leave a Reply