rendered paste bodystop();
function onEnterFrame()
{
// debug textfield
TXT_XY.text = _root.eko._x + ", " + _root.eko._y;
//
// Controls Player Speed
ekoSpeed = 3;
ekoBounce = 5;
// keyboard controls
with (eko)
{
if (Key.isDown(Key.DOWN))
{
_y += ekoSpeed;
if (_rotation != 90) {
_rotation = 90;
}
}
if (Key.isDown(Key.UP))
{
_y -= ekoSpeed;
_rotation = -90;
}
if (Key.isDown(Key.LEFT))
{
_x -= ekoSpeed;
_rotation = 180;
}
if (Key.isDown(Key.RIGHT))
{
_x += ekoSpeed;
_rotation = 0;
}
// detect if edges of the player is colliding with the Maze Walls
if (MC_Maze.hitTest(getBounds(_root).xMax, _y, true))
{
//trace("right");
_x -= ekoBounce;
}
if (MC_Maze.hitTest(getBounds(_root).xMin, _y, true))
{
//trace("left");
_x += ekoBounce;
}
if (MC_Maze.hitTest(_x, getBounds(_root).yMax, true))
{
//trace("down");
_y -= ekoBounce;
}
if (MC_Maze.hitTest(_x, getBounds(_root).yMin, true))
{
//trace("up");
_y += ekoBounce;
}
}
}