Discuss Scratch

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:
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.
otaku_neko_cat1103
Scratcher
5 posts

how to make your sprite jump diagonally in a game

thanks
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

DiamondSwordScratch wrote:

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

jeleyse wrote:

DiamondSwordScratch wrote:

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?
Just use those keys and glide blocks inside separated if_then blocks.
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

jeleyse wrote:

DiamondSwordScratch wrote:

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?
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.
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
Nezon
Scratcher
1000+ posts

how to make your sprite jump diagonally in a game

cs4554883 wrote:

i'm going to try it wish me luck
Please don't necropost

Necropost

Powered by DjangoBB