I have placed your code into code tags and properly indented it for clarity - not only is it easier to read by indenting it but it also helps to pick out any errors that may occur from misplacing {'s and }'s. I have corrected the code below for you - you basically inserted an extra } at the end of the second onClipEvent statement. Remember any code attached to a movie clip MUST be contained within an onClipEvent statement so in other words it wasn't.
I hope this works, this is the only obvious error I can see without actually reproducing the error in flash. If it doesn't then let me know
Code:
onClipEvent (load) { speed = 0; maxmove = 15; }
onClipEvent (enterFrame) { if (_root.dead) { this.gotoAndStop("dead"); } else { speed *= .85; if (speed>0) { dir = "right"; } else if (speed<0) { dir = "left"; } if (dir == "right"){ this._x += speed; _root._x -= speed; } if (dir == "left") { this._x += speed; _root._x -= speed; } if (Key.isDown(Key.LEFT)) { if (speed>-maxmove) { speed--; } this.gotoAndStop("run"); this._xscale = -100; } else if (Key.isDown(Key.RIGHT)) { if (speed<maxmove) { speed++; } this._xscale = 100; this.gotoAndStop("run"); } if (speed<1 && speed>-1 && !attacking) { speed = 0; this.gotoAndStop("idle"); } }
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