I am trying to make an enemy for a side-scrolling platformer game that is similar to the green turtle in Super Mario. It needs to go 1 direction 1st then either turn when hitting a wall or fall if it walks over the edge. I am programming using separate as files connected together and so far have come up with the following code files.
enemy_test.as:
package
{
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class inkman_enTest extends MovieClip
{
public var Enemy:enemy;
public var walls:Array;
public var gtimer:Timer;
public function inkman_enTest()
{
walls = new Array();
Enemy = new enemy();
addChild( Enemy );
gtimer= new Timer(25);
gtimer.addEventListener(TimerEvent.TIMER, gameLoop);
gtimer.start();
}
function gameLoop(loop:TimerEvent):void
{
Enemy.en_move();
}
}
}
enemy.as:
package
{
import flash.display.MovieClip;
public class enemy extends MovieClip
{
public function en_start()
{
x= 100; // Variables for enemy starting place.
y= 10;//
}
public function en_move():void
{
this.x +=3;// Initial movement
}
}
}
wall.as:
package
{
import flash.display.MovieClip;
public class Wall extends MovieClip
{
public var WIDTH:int = 32;
public var HEIGHT:int = 32;
}
}
Any help would be appreciated. If not can I you point me to a website or forum where I can get more information. Thanks.