PDA

View Full Version : Game control help


Pedal-kid
07-15-2008, 10:13 PM
I am going to make a stickman fighting game, and I have got to controls.
When I hold down "enter" at the same time the stickman named "dude" is touching the stickman named "bluedude", I won't bluedude to lose 10HP
bluedudes HP var is "bluehp" what did I do wrong here?:

onEnterFrame=function() {
if (dude.hitTest(bluedude)==true)&&{if (Key.isDown(Key.ENTER)) {
bluehp-=10;
}



}

}

Noct
07-16-2008, 06:26 PM
You have some syntax errors in there for one thing, give this a shot:

var bluehp:Number = 100;
dude.onEnterFrame = function() {
if ((this.hitTest(bluedude)) && (Key.isDown(Key.ENTER))) {
bluehp -= 10;
trace("bluehp = "+bluehp);
}
};