View Full Version : SCRIPT problem
leoHEK
October 10th, 2004, 10:51 PM
I know this script is full of errors but could anyone make it correct.
onClipEvent (load) {
this.stop();
_root.winner = "Fight!";
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
this.gotoAndStop("attack");
this.attack.play(1);
}
if (this.attack.fist.hitTest(_root.badGuy)) {
_root.ehp.nextFrame();
if.ehp. (_currentframe == 20)
gotoAndStop("win");
}
}
"ehp" is the name of a of a enemy healthbar.:crazy:
Dr Warm
October 10th, 2004, 11:14 PM
hm i would have this
onClipEvent (load) {
this.stop();
_root.winner = "Fight!";
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
this.gotoAndStop("attack");
_root.attack.gotoAndPlay(1);
}
if (_root.attack.fist.hitTest(_root.badGuy)) {
_root.ehp.nextFrame();
}
if(_root.ehp._currentframe == 20){
_root.gotoAndStop("win");
}
}
but i have to ask a few questions:
1) is attack a seperate mc from the player? or is it inside the player?
2) is the line gotoAndStop("win") supposed to be for the main timeline? or does the character have a winning pose or something?
leoHEK
October 10th, 2004, 11:29 PM
attack is in the player.
Win is aon the main timeline.
Dr Warm
October 10th, 2004, 11:34 PM
ok then it should be:
<code>
onClipEvent (load) {
this.gotoAndStop(1);
_root.winner = "Fight!";
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
this.gotoAndStop("attack");
this.attack.gotoAndPlay(1);
}
if (this.attack.fist.hitTest(_root.badGuy)) {
_root.ehp.nextFrame();
}
if(_root.ehp._currentframe == 20){
_root.gotoAndStop("win");
}
} </code>
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.