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

#1 2012-07-16 16:31:41

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

putting key controls in an if

how to put key controls inside of an if so i can only control a sprite with the keys if i recieve a certain broadcast?

plz help if u know how

Offline

 

#2 2012-07-16 16:37:44

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: putting key controls in an if

bump

Offline

 

#3 2012-07-16 16:37:50

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: putting key controls in an if

when I receive [controls v]
forever
if <key [up arrow v] pressed?>
change y by (5)
end
if <key [down arrow v] pressed?>
change y by (-5)
end
if <key [right arrow v] pressed?>
change x by (5)
end
if <key [left arrow v] pressed?>
change x by (-5)
end
Is this what you're trying to do?


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#4 2012-07-16 16:38:05

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: putting key controls in an if

Try this:

when I receive [Control v]
forever
if<key [right arrow v] pressed?>
change x by (1)
end
if<key [left arrow v] pressed?>
change x by (-1)
end
if<key [up arrow v] pressed?>
change y by (1)
end
if<key [down arrow v] pressed?>
change y by (-1)
end
end
EDIT: Wow, AB3, you were 15 seconds ahead of me...

Last edited by amcerbu (2012-07-16 16:38:48)

Offline

 

#5 2012-07-16 16:38:55

marcin388
Scratcher
Registered: 2011-11-24
Posts: 100+

Re: putting key controls in an if

go to Sensing and find key space pressed block


If you like shooter and adventure games: Space Adventures Underwater Adventures These are the two professional scratch games made by me, hope you enjoy them.

Offline

 

#6 2012-07-16 16:43:00

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: putting key controls in an if

both the same, so thx alot both of u

Offline

 

#7 2012-07-16 17:07:18

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: putting key controls in an if

u too march

Offline

 

#8 2012-07-16 17:11:49

XXtitaniumfangXX
New Scratcher
Registered: 2012-07-12
Posts: 57

Re: putting key controls in an if

XXtitaniumfangXX wrote:

u too march

marcin, srry

Offline

 

Board footer