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

#1 2011-08-08 09:36:05

jrmcintosh
New Scratcher
Registered: 2011-07-20
Posts: 1

If Not Key Pressed

I'd like to create a piece of functionality where my game responds negatively if a certain key is not pressed.

Is there anyway I can set functionality on if any key is pressed and then do an if clause if it's not the right key.

I've tried the following but it didn't meet my expectations:

<if><<  <not>  >><key[  ]pressed?>

Offline

 

#2 2011-08-08 10:51:30

danwoodski
Scratcher
Registered: 2009-12-23
Posts: 100+

Re: If Not Key Pressed

Instead of using the "Not [key pressed]" try using "key [] pressed = false"...like this:
http://dl.dropbox.com/u/12506914/if%20key%20pressed%20equals%20false.gif


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://dl.dropbox.com/u/12506914/Pics/p2e-2.png&amp;link2=http://dl.dropbox.com/u/12506914/Pics/ms.png&amp;link3=http://dl.dropbox.com/u/12506914/Pics/block%20lib.png
Starting to move on to other languages, but I'll still be around from time to time  smile

Offline

 

#3 2011-08-08 14:00:24

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: If Not Key Pressed

When flag pressed
forever if <not < key e pressed? > >
| CODE
|_______________________________


You can now reach me on Twitter @johnnydean1_

Offline

 

#4 2011-08-08 14:48:26

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: If Not Key Pressed

I'd say this belongs in All About Scratch. Remember that questions related to programming in Scratch go in All About Scratch, no matter how "advanced." I'll move it for you.  smile


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer