Discuss Scratch

thebutterwarrior
Scratcher
6 posts

How Do You Jump And Move At The Same Time???

If someone knows how I can make a jump and move script please tell me?
tucker53
Scratcher
21 posts

How Do You Jump And Move At The Same Time???

what dont you get about it share progect your having dif with ill help
andre_rifaut
Scratcher
100+ posts

How Do You Jump And Move At The Same Time???

thebutterwarrior
Scratcher
6 posts

How Do You Jump And Move At The Same Time???

Project: Slime Wars: Link: http://scratch.mit.edu/projects/3290542/
andre_rifaut
Scratcher
100+ posts

How Do You Jump And Move At The Same Time???

See the red house code in http://scratch.mit.edu/projects/10175226
This is an application of the idea presented in http://scratch.mit.edu/projects/10170032/
Satanshu
New Scratcher
2 posts

How Do You Jump And Move At The Same Time???

Yes but i want to know how to jump and move left or right
Desertdweller123
Scratcher
100+ posts

How Do You Jump And Move At The Same Time???

This is the code i usually use for gravity.
MrMcProgram
Scratcher
2 posts

How Do You Jump And Move At The Same Time???

I have the same problem!
SwordGaming55
New Scratcher
1 post

How Do You Jump And Move At The Same Time???

you keep the jumping code and the moving code separate. simple
Scotiaebot
Scratcher
3 posts

How Do You Jump And Move At The Same Time???

I need to know because im making a game and I am a bit stuck
RichardStarbright
Scratcher
38 posts

How Do You Jump And Move At The Same Time???

when [space] key pressed
repeat (5)
change y by (3)
end
repeat (5)
change y by (-3)
end
do whatever jump script you be doin here, and do it with Y varibles ONLY, if anything. I provided a good example of jumping here.

when [right arrow] key pressed
change x by (3)
when [left arrow] key pressed
change x by (-3)
Be sure to use the X varibles ONLY here.


Because the X varibles and Y varibles are independent, they can act simutaniously, which is the key to doing this. In addition, I made the scripting fairly simple- an added bonus of less work and less lag!

Last edited by RichardStarbright (Aug. 29, 2014 19:33:23)

Scotiaebot
Scratcher
3 posts

How Do You Jump And Move At The Same Time???

That doesn't help because all that happens is that you go up then stay there.
NoChutney
Scratcher
48 posts

How Do You Jump And Move At The Same Time???

If you want to do movement and jumping, you're going to need to use a gravity variable and define the floor (either as a sprite or with a colour or just as a set of co-ordinates on the screen). You also need to put the movement and jump controls in a Forever loop.

I've put together a simple demo to demonstrate this:

http://scratch.mit.edu/projects/26055261/

I hope it's helpful.

The trick is not to tie movement block directly to key strokes
when [ v] key pressed
change x by ()
but instead use variables to track where the player should be. Take a look at the code and it should make sense.
typemaster
Scratcher
100+ posts

How Do You Jump And Move At The Same Time???

Script for jumping and moving with the same trigger:
when [space] key pressed
repeat (5)
change y by (10)
end
repeat (5)
change x by (10)
end
If you want to also be able to straight up jump, do this:
when [up arrow] key pressed
change y by (10)
when [right arrow] key pressed
change x by (10)
Then, you mush make the bottom of the background black. After you have done that, do this:
when green flag clicked
forever
if <not <touching color [black] ?>> then
repeat until <touching color [black] ?>
change y by (-10)
end
end
end

Last edited by typemaster (Aug. 30, 2014 15:40:13)

typemaster
Scratcher
100+ posts

How Do You Jump And Move At The Same Time???

typemaster wrote:

Script for jumping and moving with the same trigger:
when [space] key pressed
repeat (5)
change y by (10)
end
repeat (5)
change x by (10)
end
If you want to also be able to straight up jump, do this:
when [up arrow] key pressed
change y by (10)
when [right arrow] key pressed
change x by (10)
Then, you mush make the bottom of the background black. After you have done that, do this:
when green flag clicked
forever
if <not <touching color [black] ?>> then
repeat until <touching color [black] ?>
change y by (-10)
end
end
end

Replace “black” with the actual color in the program.
typemaster
Scratcher
100+ posts

How Do You Jump And Move At The Same Time???

Scotiaebot wrote:

That doesn't help because all that happens is that you go up then stay there.
LOL… 2 in the morning
GreenElephant107
New Scratcher
3 posts

How Do You Jump And Move At The Same Time???

http://scratch.mit.edu/projects/42323154/#editor check all the scripts except the one with the animation…
SapphireGirl
Scratcher
16 posts

How Do You Jump And Move At The Same Time???

I tried the one on the wiki and it doesn't work for me. Whenever I press the up arrow key the sprite never moves.
Help, please.

Powered by DjangoBB