Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Please, help.
- thebillington
-
Scratcher
68 posts
Please, help.
Hi MrEldar,
Could you be a bit more specific?
If you simply want to make your character move when you press the arrow keys then you could do something like:
If you understand how a coordinate grid system works, the x axis is your horizontal movement and the y axis is your vertical movement:
Link to an image of the Scratch coordinate system
By changing your y by a negative number i.e -5, you make your characters position on the y axis move downward. By making this a positive number you move them up.
There are lots of different ways you can use physics to make your character do interesting things on the vertical. If you want to see how to implement gravity look at some of the engines in my signature.
Hope that helps,
Mr Rebecchi
Could you be a bit more specific?
If you simply want to make your character move when you press the arrow keys then you could do something like:
when green flag clicked
forever
if <key [up arrow v] pressed?> then
change y by (5)
end
if <key [down arrow v] pressed?> then
change y by (-5)
end
if <key [left arrow v] pressed?> then
change x by (-5)
end
if <key [right arrow v] pressed?> then
change x by (5)
end
end
If you understand how a coordinate grid system works, the x axis is your horizontal movement and the y axis is your vertical movement:
Link to an image of the Scratch coordinate system
By changing your y by a negative number i.e -5, you make your characters position on the y axis move downward. By making this a positive number you move them up.
There are lots of different ways you can use physics to make your character do interesting things on the vertical. If you want to see how to implement gravity look at some of the engines in my signature.
Hope that helps,
Mr Rebecchi
Last edited by thebillington (Dec. 9, 2016 09:55:20)
- MrEldar
-
Scratcher
7 posts
Please, help.
Hi MrEldar,Thanks
Could you be a bit more specific?
If you simply want to make your character move when you press the arrow keys then you could do something like:when green flag clicked
forever
if <key [up arrow v] pressed?> then
change y by (5)
end
if <key [down arrow v] pressed?> then
change y by (-5)
end
if <key [left arrow v] pressed?> then
change x by (-5)
end
if <key [right arrow v] pressed?> then
change x by (5)
end
end
If you understand how a coordinate grid system works, the x axis is your horizontal movement and the y axis is your vertical movement:
Link to an image of the Scratch coordinate system
By changing your y by a negative number i.e -5, you make your characters position on the y axis move downward. By making this a positive number you move them up.
There are lots of different ways you can use physics to make your character do interesting things on the vertical. If you want to see how to implement gravity look at some of the engines in my signature.
Hope that helps,
Mr Rebecchi
- Discussion Forums
- » Help with Scripts
-
» Please, help.


