Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make a sprite move when you klick a button ( up, down, left or right )
- aerielle2003
-
New Scratcher
96 posts
How to make a sprite move when you klick a button ( up, down, left or right )
I need help for my new game the sprite has to go up when the up button is pressed
- crystalbeastpikachu
-
Scratcher
36 posts
How to make a sprite move when you klick a button ( up, down, left or right )
If you mean the arrow key:
If you mean a sprite clicked:
sprite that's being clicked:
sprite that's moving:
when key [up arrow v] pressed
change y by ( 5 )
If you mean a sprite clicked:
sprite that's being clicked:
when this sprite clicked
broadcast [go up v]
sprite that's moving:
when I receive [go up v]
change y by ( 5 )
Last edited by crystalbeastpikachu (Sept. 25, 2013 12:42:15)
- aerielle2003
-
New Scratcher
96 posts
How to make a sprite move when you klick a button ( up, down, left or right )
Thanks
- gastoot
-
Scratcher
2 posts
How to make a sprite move when you klick a button ( up, down, left or right )
wait, so you do
ch
ch
change y by (5)
- scubajerry
-
Scratcher
1000+ posts
How to make a sprite move when you klick a button ( up, down, left or right )
wait, so you doYes, unless somewhere else there is a
chchange y by (5)
set [5 v] to [5]
- 1KOSTYNIUROB
-
Scratcher
4 posts
How to make a sprite move when you klick a button ( up, down, left or right )
say [Food] for (2) secs
- typemaster
-
Scratcher
100+ posts
How to make a sprite move when you klick a button ( up, down, left or right )
Script for the button:
Script for the sprite:
when this sprite clicked
broadcast [move_sprite]
Script for the sprite:
when I receive [move_sprite]
//put the move block here. I didn't use it because I don't know what way you want to move it in.
- stampyshorthead
-
Scratcher
86 posts
How to make a sprite move when you klick a button ( up, down, left or right )
when [up arrow] key pressed
point in direction (up)
move (<insert number of steps here>) steps
- cuppiedonut
-
New Scratcher
1 post
How to make a sprite move when you klick a button ( up, down, left or right )
ok
if <> then
end
- casadesteve
-
Scratcher
2 posts
How to make a sprite move when you klick a button ( up, down, left or right )
The new way of movement -
sed
when [ right arrow] key pressedmo
move (1) steps
- digthebone
-
Scratcher
500+ posts
How to make a sprite move when you klick a button ( up, down, left or right )
when green flag clickedi use this engine all the time in my games.
forever
if <key [left arrow v] pressed?> then
change x by (-5)
end
if <key [right arrow v] pressed?> then
change x by (5)
end
if <key [up arrow v] pressed?> then
change y by (5)
end
if <key [down arrow v] pressed?> then
change y by (-5)
end
end
Last edited by digthebone (Jan. 1, 2015 04:32:12)
- ozstaff
-
Scratcher
2 posts
How to make a sprite move when you klick a button ( up, down, left or right )

- Blank1234
-
Scratcher
500+ posts
How to make a sprite move when you klick a button ( up, down, left or right )
when green flag clicked
set [x accel v] to [0 ]
set [y accel v] to [0 ]
forever
if <key [right v] pressed?> then
change [x accel v] by (0.3)
end
if <key [left v] pressed?> then
change [x accel v] by (-0.3)
end
if <not <<key [left v] pressed?> or <key [right v] pressed?>>>
set [x accel v] to ((0.9) * (x accel))
end
if <key [up v] pressed?> then
change [y accel v] by (0.3)
end
if <key [down v] pressed?> then
change [y accel v] by (-0.3)
end
if <not <<key [down v] pressed?> or <key [up v] pressed?>>>
set [y accel v] to ((0.9) * (y accel))
end
change x by (x accel)
change y by (y accel)
end
hope this helps!
Last edited by Blank1234 (Aug. 3, 2015 13:57:23)
- supp45
-
New Scratcher
1 post
How to make a sprite move when you klick a button ( up, down, left or right )
How do you get the red things
- Delphox915
-
Scratcher
100+ posts
How to make a sprite move when you klick a button ( up, down, left or right )
How do you get the red thingsType in a block that doesn't exist, like “hello”, put the tag, and done.
404 block not fond :: hat
this block does not exist :: cstart
Last edited by Delphox915 (Dec. 9, 2015 05:43:44)
- DragonHearts
-
Scratcher
100+ posts
How to make a sprite move when you klick a button ( up, down, left or right )
This block doesn't exsist but it's still coloured::events
This block doesn't exsist and is grey::grey
- deck26
-
Scratcher
1000+ posts
How to make a sprite move when you klick a button ( up, down, left or right )
There's a sticky topic for trying out Scratchblocks, please don't necropost on another Scratcher's forum topic to do it.
- Discussion Forums
- » Help with Scripts
-
» How to make a sprite move when you klick a button ( up, down, left or right )