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

#1 2012-10-18 17:26:07

InfamousGeoff
New Scratcher
Registered: 2012-10-18
Posts: 9

Press space loop.

OK now how can i use the space again without repeating the same actions. I tried stop script. When i press space to continue It puts me in a loop for the first when space is pressed bit of code. Should i just use another Broadcast or is there an easier way?

Offline

 

#2 2012-10-18 17:34:35

InfamousGeoff
New Scratcher
Registered: 2012-10-18
Posts: 9

Re: Press space loop.

Another broadcast did not work still puts me in a loop. Please help!! and Thank you!!

Offline

 

#3 2012-10-18 17:42:16

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Press space loop.

An easy solution is to require one key to stop and another to start.


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#4 2012-10-18 18:13:06

InfamousGeoff
New Scratcher
Registered: 2012-10-18
Posts: 9

Re: Press space loop.

I guess i should not call it a loop. Its just i set press space to start the game and now i want to press space to continue after a correct answer but when you press space it goes back to start game.

Offline

 

#5 2012-10-18 18:27:39

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: Press space loop.

Well, use a different key for both functions.

Or, you could do it this way:

when gf clicked
set [gamestarted v] to (0)

when [space v] key pressed
if <(gamestarted) = (0)>
  set [gamestarted v] to (1)
  put your game blocks here
else
  put your continue blocks here
end

Last edited by BoltBait (2012-10-18 18:29:41)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#6 2012-10-18 18:31:51

InfamousGeoff
New Scratcher
Registered: 2012-10-18
Posts: 9

Re: Press space loop.

BoltBait wrote:

Well, use a different key for both functions.

Or, you could do it this way:

when gf clicked
set [gamestarted v] to (0)

when [space v] key pressed
if <(gamestarted) = (0)>
  set [gamestarted v] to (1)
  put your game blocks here
else
  put your continue blocks here
end

Thank you i did not think about a if else statement. That should work!

Offline

 

#7 2012-10-18 18:35:18

InfamousGeoff
New Scratcher
Registered: 2012-10-18
Posts: 9

Re: Press space loop.

This is going to be a game for baby's so i really need to stick with simple keys like space. That is why i don't really want to change the keys. but now i have a lot to change. Making this for my 1 year old. she loves computers especially my keyboard!!

Offline

 

#8 2012-10-18 19:14:03

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Press space loop.

InfamousGeoff wrote:

This is going to be a game for baby's so i really need to stick with simple keys like space. That is why i don't really want to change the keys. but now i have a lot to change. Making this for my 1 year old. she loves computers especially my keyboard!!

Well then, good luck with making your project! I hope that your daughter likes your game!


http://i46.tinypic.com/35ismmc.png

Offline

 

#9 2012-10-18 22:32:08

Walkthrough101
New Scratcher
Registered: 2012-10-17
Posts: 11

Re: Press space loop.

Can you post it to the website?

Offline

 

#10 2012-10-19 06:05:48

InfamousGeoff
New Scratcher
Registered: 2012-10-18
Posts: 9

Re: Press space loop.

Walkthrough101 wrote:

Can you post it to the website?

Will do as soon as i finish. This is actually gonna be my project for CS 50. But i figured i would try to make something useful for my little girl in the process. only have another week to get it done and still having some issues with the space bar being implemented as different commands. If/else i do not think will work for this. I need to find a way to possibly hide my previous command or ignore it and start a new one. or else i am gonna have to use a mouse pointer touching or something else. She really loves to peck on my keyboard. So i hope to get the space bar to work for me as it is the most hit key.

Offline

 

#11 2012-10-19 06:33:40

InfamousGeoff
New Scratcher
Registered: 2012-10-18
Posts: 9

Re: Press space loop.

Ahh figured it out just using a if statement and a hidden variable. when space key pressed add 1 to variable. If variable is 1 broadcast 1 thing/ if variable is two broadcast another and so on. now to rewrite everything. thanks BoltBait was looking at your idea as i figured it out.

Offline

 

Board footer