Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to make your sprite jump diagonally in a game
- otaku_neko_cat1103
-
Scratcher
5 posts
how to make your sprite jump diagonally in a game
so in this game I am making, I Need the player sprite to jump diagonally when the up arrow and side arrow are pressed, how can I do this (P.S I also need the code to make the player come down, I do not want it to float to the top of the screen)
- DiamondSwordScratch
-
Scratcher
29 posts
how to make your sprite jump diagonally in a game
Could try:
It would look slightly diagonal, but should work.
when green flag clicked
forever
if <<key [up arrow v] pressed?> and <key [right arrow v] pressed?> > then
glide (1) secs to x: ((x position) + (25)) y: ((y position) + (25))
glide (1) secs to x: ((x position) + (25)) y: ((y position) - (25))
end
end
It would look slightly diagonal, but should work.
- BKFighter
-
Scratcher
1000+ posts
how to make your sprite jump diagonally in a game
Put the jumping and left right movement in two different loops/scripts.
- jeleyse
-
Scratcher
23 posts
how to make your sprite jump diagonally in a game
Could try:when green flag clicked
forever
if <<key [up arrow v] pressed?> and <key [right arrow v] pressed?> > then
glide (1) secs to x: ((x position) + (25)) y: ((y position) + (25))
glide (1) secs to x: ((x position) + (25)) y: ((y position) - (25))
end
end
It would look slightly diagonal, but should work.
I tried this, and it wouldn't work nor would it even let my character move. Are you sure that there is no other way to do this?
- asivi
-
Scratcher
1000+ posts
how to make your sprite jump diagonally in a game
Just use those keys and glide blocks inside separated if_then blocks.Could try:when green flag clicked
forever
if <<key [up arrow v] pressed?> and <key [right arrow v] pressed?> > then
glide (1) secs to x: ((x position) + (25)) y: ((y position) + (25))
glide (1) secs to x: ((x position) + (25)) y: ((y position) - (25))
end
end
It would look slightly diagonal, but should work.
I tried this, and it wouldn't work nor would it even let my character move. Are you sure that there is no other way to do this?
Ooops!
Last edited by asivi (Jan. 22, 2017 22:31:29)
- duckboycool
-
Scratcher
1000+ posts
how to make your sprite jump diagonally in a game
Please don't revive dead topics, make new ones instead (Unless you can find your answer without posting on the topic). But for this to work, you need to press both up, and right.Could try:when green flag clicked
forever
if <<key [up arrow v] pressed?> and <key [right arrow v] pressed?> > then
glide (1) secs to x: ((x position) + (25)) y: ((y position) + (25))
glide (1) secs to x: ((x position) + (25)) y: ((y position) - (25))
end
end
It would look slightly diagonal, but should work.
I tried this, and it wouldn't work nor would it even let my character move. Are you sure that there is no other way to do this?
- scratchguy51
-
Scratcher
1 post
how to make your sprite jump diagonally in a game
thank you this really worked for my game

- cs4554883
-
New Scratcher
1 post
how to make your sprite jump diagonally in a game
i'm going to try it wish me luck
- Discussion Forums
- » Help with Scripts
-
» how to make your sprite jump diagonally in a game