Here is what I am trying to implement. This is a battle screen. The scene is named Dungeon. I need this scene to randomly appear between .5 and 3 seconds. When this scene appears, A enemy will be called from the library to the main stage. However, I want the enemy to be positioned in 1 of the 6 spots. I can call the enemy to the stage by defining the specific x,y coordinates, but I want the enemy to be called to the stage to 1 of the 6 spots randomly. Here is how the stage is laid out:
[LIST]
[]I have 6 movieclips named: spot1, spot2, spot3, spot4, spot5, spot6
[]I have 1 movieclip named: enemy
[/LIST]
Here is the code I have on the main timeline:
stop();
hp = 100;
eHealth = 100;
this.attachMovie(“monster1”,“monster1”,0,{_x:100, _y:100});
monster1.onEnterFrame = function() {
monster1.onRollOver = function() {
_root.gunman.gotoAndStop(2);
};
monster1.onRollOut = function() {
_root.gunman.gotoAndStop(1);
};
monster1.onRelease = function() {
if (_root.monster1.hitTest(_root._xmouse, _root._ymouse)) {
_root.eHealth -= 10;
_root.hp -= 5;
gunSound = new Sound(this);
gunSound.attachSound("Gunshot");
gunSound.start();
}
if (_root.eHealth<=0) {
_root.monster1.gotoAndStop(2);
_root.hp = 100;
};
}
};
Here is what I am wanting the end result to be:
- I need the scene Dungeon to randomly appear between .5 and 3 seconds.
- When the Dungeon scene appears, I want the enemy to randomly appear in 1 of the 6 spots. When the enemy appears, he will stay locked into 1 of the 6 spots until the enemy is killed, or the hero is killed.
I had an early post running, however it was getting confusing, so this is a much updated and cleaner version. Thanks all for your help and support with my adventure in indie game design.
Jason D. Scholz