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

#1 2010-08-08 00:15:45

angelpeach23
New Scratcher
Registered: 2010-08-07
Posts: 1

How do you make sprite move with arrow keys???

I wanna make a sort of platform game but I don't know how you make the sprite move using the arrow keys. Please answer! I'm sooo confused!

Offline

 

#2 2010-08-08 00:29:09

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

Re: How do you make sprite move with arrow keys???

Try this:
http://i35.tinypic.com/11m6gbr.gif

Hope that helps!  smile


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

Offline

 

#3 2010-08-08 07:11:14

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: How do you make sprite move with arrow keys???

[blocks]
<forever>
<if><key[ right arrow ]pressed?>
<change x by(5
<end>
<if><key[ left arrow ]pressed?>
<change x by(-5
<end>
<if><key[ up arrow ]pressed?>
<change y by(5
<end>
<if><key[ down arrow ]pressed?>
<change y by(-5
<end>
<end>
[/blocks]



Hope this helps  big_smile

Last edited by HD123 (2010-08-08 07:12:28)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&amp;online=http://lemonfanatic.webs.com/ONLINE.png&amp;offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#4 2010-08-08 19:31:28

brinkbrink
Scratcher
Registered: 2010-07-14
Posts: 1000+

Re: How do you make sprite move with arrow keys???

Try downloading this project :
http://scratch.mit.edu/projects/brinkbrink/1236389

Hope it helps!  big_smile


New sig coming soon.

Offline

 

#5 2010-08-08 22:56:18

jman13
Scratcher
Registered: 2009-12-09
Posts: 65

Re: How do you make sprite move with arrow keys???

you can also do scrolling,
try this:
http://scratch.mit.edu/forums/viewtopic.php?id=2440
hope that helps.

Last edited by jman13 (2010-08-08 22:57:44)

Offline

 

#6 2010-08-09 08:00:07

chipguy
Scratcher
Registered: 2009-09-09
Posts: 500+

Re: How do you make sprite move with arrow keys???

herers one a bit different
[blocks]<when green flag clicked>
<forever>
<if><key[ up ]pressed?>
<move( 5 )steps>
<end>
<if><key[ right ]pressed?>
<turn cw( 5 )degrees>
<end>
<if><key[ left ]pressed?>
<turn cw( -5 )degrees>
<end>
<end>



sorry! they are always so messy!


http://scratch.mit.edu/static/projects/chipguy/2919121_sm.png by yours truly  big_smile

Offline

 

#7 2010-08-09 11:58:48

Telemachus
Scratcher
Registered: 2010-04-21
Posts: 500+

Re: How do you make sprite move with arrow keys???

In any event, try to steer clear of the [When key "right arrow" pressed] block. The movement methods suggested by previous posters are much better  smile


http://i54.tinypic.com/10h0fnp.jpg

Offline

 

#8 2010-08-09 16:33:06

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

Re: How do you make sprite move with arrow keys???

Telemachus wrote:

In any event, try to steer clear of the [When key "right arrow" pressed] block. The movement methods suggested by previous posters are much better  smile

Do you mean the hat blocks? Yeah, stay away from those.  roll


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

 

#9 2010-08-09 17:41:31

chipguy
Scratcher
Registered: 2009-09-09
Posts: 500+

Re: How do you make sprite move with arrow keys???

Harakou wrote:

Telemachus wrote:

In any event, try to steer clear of the [When key "right arrow" pressed] block. The movement methods suggested by previous posters are much better  smile

Do you mean the hat blocks? Yeah, stay away from those.  roll

hat blocks? i'm confused...  hmm



and are you talking about me above?

Last edited by chipguy (2010-08-09 17:42:01)


http://scratch.mit.edu/static/projects/chipguy/2919121_sm.png by yours truly  big_smile

Offline

 

#10 2010-08-11 00:07:58

graham7sarah9
Scratcher
Registered: 2009-07-19
Posts: 28

Re: How do you make sprite move with arrow keys???

By hat blocks he means things like:
<when green flag clicked>
<when I receive[
and<when[  ]key pressed>
It executes the script once the event happens. All legitimate scripts must have a hat block or else there's no way to start it while playing the game.
The first two are alright but don't use the last one unless you have to. It's off timing.
See what I mean by making a script for a sprite like this:
<when[ up arrow ]key pressed>
<change y by( 10 )
Now, hold the up arrow key down.

Offline

 

#11 2010-08-11 00:42:41

KaltSoldat
Scratcher
Registered: 2010-07-09
Posts: 100+

Re: How do you make sprite move with arrow keys???

graham7sarah9 wrote:

By hat blocks he means things like:
<when green flag clicked>
<when I receive[
and<when[  ]key pressed>
It executes the script once the event happens. All legitimate scripts must have a hat block or else there's no way to start it while playing the game.
The first two are alright but don't use the last one unless you have to. It's off timing.
See what I mean by making a script for a sprite like this:
<when[ up arrow ]key pressed>
<change y by( 10 )
Now, hold the up arrow key down.

Ah, yes, when you press the up arrow in this script it will execute it once, but if you were to put a repeat until not up arrow pressed, then it will assume that you are going to be holding down the arrow for more smooth movement.

Offline

 

#12 2010-08-11 00:44:38

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do you make sprite move with arrow keys???

^^^^ yeah and that script is so annoying


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#13 2010-08-11 00:49:13

KaltSoldat
Scratcher
Registered: 2010-07-09
Posts: 100+

Re: How do you make sprite move with arrow keys???

murpho wrote:

^^^^ yeah and that script is so annoying

What do you mean by that.

Offline

 

#14 2010-08-11 00:54:21

murpho
Scratcher
Registered: 2010-07-01
Posts: 1000+

Re: How do you make sprite move with arrow keys???

KaltSoldat wrote:

murpho wrote:

^^^^ yeah and that script is so annoying

What do you mean by that.

It doesnt run as smoothly


https://lh6.googleusercontent.com/-l-rgCPiQ9pY/Tp32n1MRUEI/AAAAAAAADoA/HNQWbO8OOaA/s510/soccerleague.gif

Offline

 

#15 2010-08-11 14:35:15

Gingercloud
Scratcher
Registered: 2010-08-09
Posts: 2

Re: How do you make sprite move with arrow keys???

It never works my sprite keeps going right instead of left,up,or down.

Offline

 

Board footer