onClipEvent (enterFrame) {
if (key.isDown(87)) {
if (Math.abs(_root.player._x-this._x)<=40 and Math.abs(_root.player._y-this._y)<=40) {
_root.textone.gotoandstop(2);
}
}
Basically it checks to see if the w button is pressed, and if the player is within range and it tells the text to appear. Its followed by other code to prevent collision with the player. The odd thing is, when I plop the npc (this) onto the main frame it works, but if I move it inside a movie clip it fails to execute, yet the code after it works.
Help?
onClipEvent (enterFrame) {
if (key.isDown(87)) {
if (Math.abs(_root.player._x-this._x)<=40 and Math.abs(_root.player._y-this._y)<=40) {
_root.textone.gotoandstop(2);
}
}
Basically it checks to see if the w button is pressed, and if the player is within range and it tells the text to appear. Its followed by other code to prevent collision with the player. The odd thing is, when I plop the npc (this) onto the main frame it works, but if I move it inside a movie clip it fails to execute, yet the code after it works. :?
Help?