rendered paste bodyMouse.hide();
leafcounter = 0;
ray_direction = 0
KeyPressListener = new Object();
KeyPressListener.onKeyDown = function() {
if (Key.isDown(Key.DOWN)) {
ray_mc.movement("Down");
} else if (Key.isDown(Key.UP)) {
ray_mc.movement("Up");
}
if (Key.isDown(Key.LEFT)) {
ray_mc.movement("Left");
ray_mc.gotoAndStop(3);
ray_direction = 1
} else if (Key.isDown(Key.RIGHT)) {
ray_mc.movement("Right");
ray_mc.gotoAndStop(4);
ray_direction = 2
}
};
KeyPressListener.onKeyUp = function() {
if (ray_direction == 1) {
ray_mc.gotoAndStop(1);
} else if (ray_direction == 2) {
ray_mc.gotoAndStop(2);
}
};
Key.addListener(KeyPressListener);
//
ray_mc.movement = function($direction) {
if ($direction == "Left") {
this._x -= 5;
} else if ($direction == "Right") {
this._x += 5;
} else if ($direction == "Up") {
this._y -= 5;
} else if ($direction == "Down") {
this._y += 5;
}
if (ray_mc.hitTest(obstacle_mc1)) {
trace("UH OH!!!");
} else if (ray_mc.hitTest(obstacle_mc2)) {
trace("I SAID UH OH!!!");
} else if (ray_mc.hitTest(obstacle_mc3)) {
trace("I SAID UH OH!!!");
} else if (ray_mc.hitTest(obstacle_mc4)) {
trace("I SAID UH OH!!!");
}
if (ray_mc.hitTest(lotus_leaf_mc1)) {
lotus_leaf_mc1.unloadMovie();
leafcounter = leafcounter+1;
leafcounter_mc.gotoAndStop(leafcounter+1);
trace("You hit leaf #1, "+leafcounter+" leafs gathered");
} else if (ray_mc.hitTest(lotus_leaf_mc2)) {
lotus_leaf_mc2.unloadMovie();
leafcounter = leafcounter+1;
leafcounter_mc.gotoAndStop(leafcounter+1);
trace("You hit leaf #2, "+leafcounter+" leafs gathered");
} else if (ray_mc.hitTest(lotus_leaf_mc3)) {
lotus_leaf_mc3.unloadMovie();
leafcounter = leafcounter+1;
leafcounter_mc.gotoAndStop(leafcounter+1);
trace("you hit leaf #3, "+leafcounter+" leafs gathered");
} else if (ray_mc.hitTest(lotus_leaf_mc4)) {
lotus_leaf_mc4.unloadMovie();
leafcounter = leafcounter+1;
leafcounter_mc.gotoAndStop(leafcounter+1);
trace("you hit leaf #4, "+leafcounter+" leafs gathered");
} else if (ray_mc.hitTest(lotus_leaf_mc5)) {
lotus_leaf_mc5.unloadMovie();
leafcounter = leafcounter+1;
leafcounter_mc.gotoAndStop(leafcounter+1);
trace("you hit leaf #5, "+leafcounter+" leafs gathered");
}
};