Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make your sprite move left and right
- goxan
-
9 posts
How to make your sprite move left and right
my sprite wont move with dis script
w
go to front
if
w
when backdrop switches to [maze]
go to front
if
if <key [down arrow key] pressed?> then
(reg. moving script)
end
- goxan
-
9 posts
How to make your sprite move left and right
How do you make your sprite follow the mouse? Show me in scripts plz. Does it have to do with this one?
go to
go to
Last edited by goxan (April 29, 2015 03:16:39)
- zinjo
-
2 posts
How to make your sprite move left and right
What I would do if it has one costume is
when green flag clicked
forever
if <key [right arrow ] pressed?> then
move (10) steps
if <key [left arrow] pressed?> then
move (-10) steps
end
- deck26
-
1000+ posts
How to make your sprite move left and right
This topic is old and you're not really adding anything to it - your script has the ‘if’s nested so the left arrow key won't work most of the time! What I would do if it has one costume iswhen green flag clicked
forever
if <key [right arrow ] pressed?> then
move (10) steps
if <key [left arrow] pressed?> then
move (-10) steps
end
Last edited by deck26 (Sept. 10, 2015 15:53:33)
- ImMrHowTo
-
6 posts
How to make your sprite move left and right
when green flag clicked
forever
stamp
wait (0.2) secs
clear
end
- nerdycats
-
5 posts
How to make your sprite move left and right
X and Y are the coordinates of the location of the sprite as you probably already know.
Here is the most efficient way to make a sprite move left and right:when [right arrow] key pressed
change x by (5)
//this is for moving right
when [left arrow] key pressed
change x by (-5)
//this is the script for moving left
Hope I helped you!
You will find that most of my projects use those scripts that I gave you.
Thanks typemaster! This really helped me!

Last edited by nerdycats (Oct. 28, 2015 16:34:57)
- spiderface127
-
1 post
How to make your sprite move left and right
To make your sprite move left and right follow this script
To move right
Go to events and drag block called (When space key pressed) change it to (When right arrow key pressed)
Then go to motion and drag move 10 steps and change it to 30 and snap the blocks together.
To move left
Go to events and drag block called (When space key pressed) change it to (When left arrow key pressed)
Then go to motion and drag move 10 steps and change it to -30 and snap the blocks together.
- LOVE54722
-
2 posts
How to make your sprite move left and right
There is a much better way than that. This is correct.
But you can add some fun.
For instance just try with the cat:when [right arrow v] key pressed
repeat (10)
move (3) steps
next costume
end
The cat will move 30 steps but you will see it move its feet.when gf clicked
forever
if <key pressed [left v]>
change x by (-5)
next costume
end
if <key pressed [right v]>
change x by (5)
next costume
end
end
Hope this helps
this helped much more! no offense to the other person. thx!
- SomeRoastBeef
-
24 posts
How to make your sprite move left and right
Where is the “Change direction” script, because I don't see it…when green flag clicked
forever
if <key [left arrow v] pressed?> then
set [moving direction v] to [left]
if <key [right arrow v] pressed?> then
set [moving direction v] to [right]
end
end
end
when green flag clicked
forever
if <(moving direction) = [right]> then
change x by (5)
if <(moving direction) = [left]> then
change x by (-5)
end
end
end
hopefully that helped
and always rememberwhen green flag clicked
forever
if <got help from digthebone.> then
know he is awesome
end
end
- Luketheamazing
-
45 posts
How to make your sprite move left and right
this is how you do it

when green flag clicked
forever
if <key [right v] pressed?> then
repeat (10)
move (5) steps
end
end
end

- Harakou
-
1000+ posts
How to make your sprite move left and right
Hi everyone, it's been two years and in that time, we've well-established how to move your sprite left and right. I think we can lay this one to rest now. 

- Discussion Forums
- » Help with Scripts
-
» How to make your sprite move left and right