Discuss Scratch

goxan
Scratcher
9 posts

How to make your sprite move left and right

my sprite wont move with dis script

w
when backdrop switches to [maze]

go to front

if
if <key [down arrow key] pressed?> then
(reg. moving script)
end
goxan
Scratcher
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

Last edited by goxan (April 29, 2015 03:16:39)

goxan
Scratcher
9 posts

How to make your sprite move left and right

go to [mouse-pointer]
zinjo
Scratcher
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
Scratcher
1000+ posts

How to make your sprite move left and right

zinjo wrote:

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

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!

Last edited by deck26 (Sept. 10, 2015 15:53:33)

ImMrHowTo
Scratcher
6 posts

How to make your sprite move left and right

when green flag clicked
forever

stamp
wait (0.2) secs
clear
end
ImMrHowTo
Scratcher
6 posts

How to make your sprite move left and right

That is just for tutorial.
nerdycats
Scratcher
5 posts

How to make your sprite move left and right

typemaster wrote:

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)

ZozaTech
Scratcher
500+ posts

How to make your sprite move left and right

Please do not necropost.
spiderface127
Scratcher
1 post

How to make your sprite move left and right

joshly50 wrote:

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
Scratcher
2 posts

How to make your sprite move left and right

KermitMC wrote:

andre_rifaut_tests wrote:

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.
There is a much better way than that.

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
Scratcher
24 posts

How to make your sprite move left and right

digthebone wrote:

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 remember
when green flag clicked
forever

if <got help from digthebone.> then
know he is awesome

end
end
Where is the “Change direction” script, because I don't see it…
Luketheamazing
Scratcher
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
Scratcher
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.

Powered by DjangoBB