Copy link to clipboard
Copied
I have an enemy that adds an attack movie clip. More specifically, this attack movie (We'll call it masterAttack) clip is a blank movie clip that acts like a super class, that will hold other attacks like a weak and strong attack. So when my enemy attacks using a timer, it adds the masterAttack on a global to local point. My problem is, on the first run, the masterAttack will attack the player wherever it is, then remove itself, which is good. Then the next time it runs, the masterAttack is not hitting the player. It's as if the globaltoLocal isn't working after the first run.
Below is the Enemy timer attacking a tile the player is on:
if (Main.tileset
{
this.addChild(masterAttack);
var pt:Point = this.masterAttack.globalToLocal(new Point(Main.tileset
masterAttack.masterEnemyAttackTimer.start();
this.masterAttack.x = (pt.x);
this.masterAttack.y = (pt.y);
}
And Below is the masterAttack timer:
function mastertimer(event:TimerEvent) {
addChild(sludgeball); //This is one of the many attacks pickable by the masterAttack
sludgeball.enemyattackTimer.start();
if (this.sludgeball.currentLabel == "End") {
this.sludgeball.gotoAndPlay(1);
masterEnemyAttackTimer.stop();
if (masterEnemyAttackTimer.running == false)
{
attackStop = true;
this.parent.removeChild(this);
removeChild(sludgeball);
}
}
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now