Jump to content
  • Advertisement
Sign in to follow this  
Kid4Today

Flash Actionscript: Programing Enemies, need help :(

This topic is 4838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello ive provided a picture to try to better explain a complication i've been having, i currently have the following code listed all on this blueCircle. My aim is to have this blueCircle move closer to the redBox and stop when it is lets say 50 frames away on either side. And while stoped, it would load a frame within the movie clip, such as a walking or fighting animation that will face the correct side. the code i am using does not work :( the blueCircle does stop in front of the redBox while it is moving towards it, but will not load the animation, and when the reBox moves to the right, the blueCircle moves with it... i dont know why Image hosted by Photobucket.com code: onClipEvent (enterFrame) { this.gotoAndPlay(22); if (citizenWhitefightingLeft = true) {citizenWhite.gotoAndPlay(91)} if (citizenWhitefightingLeft = false) {citizenWhite.gotoAndPlay(113)} if (citizenWhitefacingLeft = true) {citizenWhite.gotoAndPlay(22)} if (citizenWhitefacingLeft = false) {citizenWhite.gotoAndPlay(2)} } onClipEvent (enterFrame) { if (this._x > (_root.player._x + 50)) { speed = 2; //for when he is walking b4 he is in range to attack citizenWhite.fightingLeft = true; this._x = (this._x - speed); } else if (this._x = (_root.Player._x + 50)) { speed = 0; //for when hes close enough to attack citizenWhite.fightingleft = true; this._x = (this._x - speed); trace(this._x); } else if (this._x < (_root.Player._x - 50)) { speed = 2; //for when he is walking b4 he is in range to attack on the other side citizenWhite.facingLeft = false; this._x = (this._x + speed); } else if (this._x = (_root.Player._x - 50)) { speed = 0; //for when hes close enough to attack on the other side citizenWhite.fightingLeft = false; this._x = (this._x + speed); } } [Edited by - Kid4Today on August 18, 2005 3:31:45 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!