kizzab
02-23-2009, 02:16 PM
Hey first of all a big hello to every one on ActionScipt! I'm very new to 3.0 And flash so please bare with me! This is a great website and i suspect your receive lots of nasty script questions from me! :P
Basically at the moment i have created a character in several different poses and made them a movie clip... Im basically trying to make the animation play on a key press then return to the characters normal state..
Im trying to make a game where by a line of arrows go across the stage and a certain area is red... when the arrow is in this "red" the user pressed that arrow and if done correctly the character will run this animation and a score will be added... im trying to get this completed for friday as its part of a huge flash game / environment im involved with in a team at university! So far i have linked the character to the action script and tried this code which is wrong!!
and help would be much appreciated as im really stuck!
var timmyJump:Boolean = false;
stage.addEventListener(Event.ENTER_FRAME, run);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
function keyPressed(event:KeyboardEvent):void {
switch (event.keyCode) {
case Keyboard.UP :
timmyJump = true;
break;
}
}
function keyReleased(event:KeyboardEvent):void {
switch (event.keyCode) {
case Keyboard.UP :
timmyJump = false;
break;
}
}
Thanks for your time, and hi...
Kieren
Basically at the moment i have created a character in several different poses and made them a movie clip... Im basically trying to make the animation play on a key press then return to the characters normal state..
Im trying to make a game where by a line of arrows go across the stage and a certain area is red... when the arrow is in this "red" the user pressed that arrow and if done correctly the character will run this animation and a score will be added... im trying to get this completed for friday as its part of a huge flash game / environment im involved with in a team at university! So far i have linked the character to the action script and tried this code which is wrong!!
and help would be much appreciated as im really stuck!
var timmyJump:Boolean = false;
stage.addEventListener(Event.ENTER_FRAME, run);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
function keyPressed(event:KeyboardEvent):void {
switch (event.keyCode) {
case Keyboard.UP :
timmyJump = true;
break;
}
}
function keyReleased(event:KeyboardEvent):void {
switch (event.keyCode) {
case Keyboard.UP :
timmyJump = false;
break;
}
}
Thanks for your time, and hi...
Kieren