I am making a DDR game... and I want to make it so you can't hold down the arrows and keep scoring! But... I don't know how to do that! I could figure it out, but I'm too confused right now! Here are the scripts I am currently using:
(Right-click it and click "view image" to see the words)
I used "sensors" that are little lines hidden within the arrows at the top of the screen. If the arrows touch the sensors, then if their corresponding arrow key is pressed, they disappear. But there's a problem: If you hold down the arrow keys, when the arrows get to the sensors, they automatically get hit. Can someone tell me what I need to do?
Offline
Make variables for all the keys you are using and put this in.
This assumes you are using the space bar.
if (presing key space) {
if (spacebar = 1) {
set spacebar to 0;
broadcast (space);
}
} else {
set spacebar to 1;
}
Just make it so that the ddr arrows activate on broadcasts and repeat the above script for each key.
This how how I did it in flash.
I guess you can do this as well.
forever if (key space pressed){
broadcast space
wait until (not key space pressed)
}
I think this is what dingdong sudjested.
Last edited by archmage (2008-07-30 15:24:39)
Offline
Try making a new variable called "LeftKeyPress?" then make it like this
<<If<touchingleftsensor>and<<leftkeypressed>and<<VariableLeftKeyPress?=0> > >
Inside of the block make it [set <VariableLeftKeyPress> to 0]
Then add a block above it saying
[If <<VariableLeftKeyPress?=1>and<not<leftkeypressed>>
[set <VariableLeftKeyPress> to 1]
This makes it so if the key is pressed, the variable is 1 and cannot be pressed again. If it is released it will reset to 0 and can be pressed.
EDIT: Dingdong posted before me, didn't realise!
Last edited by SeanCanoodle (2008-07-30 15:26:10)
Offline