The McLeodGaming forums were permanently closed on April 30th, 2020. You are currently viewing a read-only archive.
View unanswered posts | View active topics It is currently Fri May 15, 2020 1:57 am

Forum rules


IMPORTANT

This Forum is for Flash related questions ONLY! Do not ask questions about spriting, Game Maker, Photoshop, or anything else not related to Flash.



 [ 1 post ] 
(Question) AS2 Assistance needed 
Author Message

Joined: Thu Aug 02, 2012 10:14 am
Posts: 1
Gender: Anime Girl
I'm using this action script to have a enemy follow my main character and attack. The following and attacking works, BUT when the player goes in back of the enemy the enemy wont turn around to follow instead it follows it while walking backwards the attack doesn't even turn around either it's attempting to attack from behind.

I'd prefer we discuss this over yahoo and I will send the swf and other needed files.

Enemy AS:


onClipEvent(enterFrame){
tx = this._x;
mx = _root.man._x;
rx = tx - mx;
if(this.hitTest(_root.man)){
this.gotoAndStop(3);
}else{
if(rx >= 1 && rx<300){
this._x -= 9;
}
if(rx <= -1 && rx>-300){
this._x += 9;
}
this.gotoAndStop(2);
}
}

The walking animation is on frame 2 and the idle animation is one frame one, but I don't think I need the idle since the enemy is never supposed to stand still, just run after and attack. Please help D:


Thu Aug 02, 2012 10:23 am
Display posts from previous:  Sort by  
 [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.