
Welcome Guest
|
#1
|
|||
|
|||
|
Listeners Keypresses and Timers
Hello, Im currently attempting to recreate R-Type in Flash MX. Ive made alot of programs in Flash, so i am familiar with it, and basic AS, but im kinda lost when it comes to games.
Anyway, im sure im gonna have quite a few questions im sure you guys could help me with in 2 seconds flat, so i'll keep them all in this thread. My first problem: Im trying to create the "big beam" The powerful fire that used to be shot by holding fire (to build up) then letting go to release, in the origional R-Type. Ive decided to just use a seperate key for this rather than the same button ive used for all the normal firing. please try and bear with me, ive never used listeners before, and neither have i used getTimer in a situation anything like this. This is what i came up with to get the "big beam"(fire6) shooting on the release of control. Actionscript:
myListener = new Object();
myListener.onKeyUp = function() {
if (Key.isDown(Key.CONTROL)) {
setProperty (_root.fire6, _x, getProperty(_root.Spaceship, _x)+90);
setProperty (_root.fire6, _y, getProperty(_root.Spaceship, _y));
with ( _root.fire6 ) {gotoAndPlay (2); //plays sound
}
}
};
Key.addListener(myListener);This has been put in a frame in the main timeline, it kinda works, but not how i want it to. When you press control it does nothing, howeva if you hold control and then press another key(eg M) on the release of M the beam will fire. What do i need to do to this to get it firing on the release of control? and how would i go about including a timer that starts when control is pressed, then when released the value of the timer is passed to the x and y values of the "big beam" mc (fire6)? If it would be helpful i'll post the fla, just say the word ![]() Thanks Scott |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|





