This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-07-30 15:11:33

joeyman
Scratcher
Registered: 2008-03-28
Posts: 1000+

Help with DDR game

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:
http://img509.imageshack.us/img509/3310/picsdu1.gif
(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?


Joeyman: On Scratch since March 28, 2008.
Over 142 projects! (And recently a Brony, and PROUD of it!)

Offline

 

#2 2008-07-30 15:14:12

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help with DDR game

How bout trying if touching color broadcast hit .like when left arrow pressed switch to a certain costume with a new color

Offline

 

#3 2008-07-30 15:17:11

joeyman
Scratcher
Registered: 2008-03-28
Posts: 1000+

Re: Help with DDR game

Then you could just hold it down and wait for it to get to the top!


Joeyman: On Scratch since March 28, 2008.
Over 142 projects! (And recently a Brony, and PROUD of it!)

Offline

 

#4 2008-07-30 15:18:47

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help with DDR game

Make it so that it switches to that costume for .5 secs.

Offline

 

#5 2008-07-30 15:18:48

dingdong
Scratcher
Registered: 2007-08-09
Posts: 1000+

Re: Help with DDR game

[wait until <not <key **** pressed>>], I use this with buttons to for [wait until <not <mouse down>>]


http://img851.imageshack.us/img851/2829/superanbanner.png
click the image for my music

Offline

 

#6 2008-07-30 15:20:28

joeyman
Scratcher
Registered: 2008-03-28
Posts: 1000+

Re: Help with DDR game

Thanks, dingdong, I'm gonna go try it now!


Joeyman: On Scratch since March 28, 2008.
Over 142 projects! (And recently a Brony, and PROUD of it!)

Offline

 

#7 2008-07-30 15:21:52

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Help with DDR game

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)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#8 2008-07-30 15:23:49

joeyman
Scratcher
Registered: 2008-03-28
Posts: 1000+

Re: Help with DDR game

IT WORKS! Thank you dingdong, I'm giving you credit!


Joeyman: On Scratch since March 28, 2008.
Over 142 projects! (And recently a Brony, and PROUD of it!)

Offline

 

#9 2008-07-30 15:24:36

dingdong
Scratcher
Registered: 2007-08-09
Posts: 1000+

Re: Help with DDR game

thanx! dingdong is always open for helping scratchers!  big_smile


http://img851.imageshack.us/img851/2829/superanbanner.png
click the image for my music

Offline

 

#10 2008-07-30 15:24:54

SeanCanoodle
Scratcher
Registered: 2008-06-20
Posts: 100+

Re: Help with DDR game

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

 

#11 2008-07-30 15:26:20

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: Help with DDR game

dingdong wrote:

[wait until <not <key **** pressed>>], I use this with buttons to for [wait until <not <mouse down>>]

Ive never thought of that i like his idea better.

Offline

 

Board footer