This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-10 20:18:03

Robloxia
Scratcher
Registered: 2011-08-06
Posts: 4

Jumping

Hey, I'm making a Paper Mario game but I can't figure out how to make Mario/Luigi jump. I've tried alot of things but nothing worked. Can someone teach me in a game or maybe reply to this? Thanks.

Offline

 

#2 2012-04-10 20:22:37

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Jumping

Try this, it checks if the sprite is touching the ground colour and the up arrow ky is pressed, and then if it is, it jumps up, then comes back down.

when gf clicked
forever if <<touching color [#FFFFFF]?>and<key [up arrow v] pressed?>>
repeat [10]
change y by [3]
end
repeat [10]
change y by [-3]
end
end

Last edited by jji7skyline (2012-04-10 20:24:28)


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#3 2012-04-11 03:39:11

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: Jumping

jji7skyline wrote:

Try this, it checks if the sprite is touching the ground colour and the up arrow ky is pressed, and then if it is, it jumps up, then comes back down.

when gf clicked
forever if <<touching color ()?>and<key [up arrow v] pressed?>>
repeat [10]
change y by [3]
end
repeat [10]
change y by [-3]
end
end

More accurately:

when gf clicked
forever
if <touching [ground v]?>
set [yvel v] to [1]
if <key [up arrow v] pressed?>
set [yvel v] to [5] //change this to change how high he jumps
end
else
change [yvel v] by [-0.5] //change this to change how fast he falls back down
end
change y by (yvel)
This covers gravity and jumping.

Offline

 

#4 2012-04-11 10:13:04

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Jumping

On the sprite that's jumping;

when green flag clicked
set (y velocity) to [0]
forever
if <touching color [#36E813]?>//Change the colour in this block to the colour of the ground.
  if <key [up arrow v] pressed?>
  set [y velocity v] to (10)
  else
  set [y velocity v] to (1)
  end
 else
   change [y velocity v] by (-1)
end
change y by (y velocity)
end


Why

Offline

 

#5 2012-04-11 10:17:18

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: Jumping

Hi.


Why are the secret organizations getting all the attention?  mad

Offline

 

#6 2012-04-11 10:52:21

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Jumping

sonicfan12p wrote:

Hi.

If you're gonna post something, make sure it's related to the thread and helpful.

Last edited by RedRocker227 (2012-04-11 10:52:58)


Why

Offline

 

#7 2012-04-11 19:27:09

CubeX57
Scratcher
Registered: 2012-04-10
Posts: 9

Re: Jumping

Thank you all, I'll try it.  smile

Offline

 

#8 2012-04-11 19:30:24

CubeX57
Scratcher
Registered: 2012-04-10
Posts: 9

Re: Jumping

Oh lol, CubeX57 is Robloxia's alt

Offline

 

#9 2012-04-11 19:54:38

Robloxia
Scratcher
Registered: 2011-08-06
Posts: 4

Re: Jumping

Thanks everyone who posted! I tried it and they all worked! Thanks!

Offline

 

Board footer