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

#1 2013-01-03 00:53:39

ianthestuntman
Scratcher
Registered: 2013-01-02
Posts: 100+

help with jumping for platformer game

I am having trouble figuring out how to make your character move while it is in the air, any help?

Offline

 

#2 2013-01-03 06:29:27

Aditya007
Scratcher
Registered: 2012-11-27
Posts: 63

Re: help with jumping for platformer game

You can do this:

when gf clicked
forever
     if <[up arrow v] pressed?>
          change [y] by [15]
     end 
end
block errors are intentional, hope u still understand


Wolf_OS!!!  smile  Check My Stuff  tongue  Need Help?  Currently, I am http://blocks.scratchr.org/API.php?user=Aditya007&amp;action=onlineStatus&amp;type=square
http://i49.tinypic.com/15gy1j6.jpg

Offline

 

#3 2013-01-03 08:33:40

Auto007
Scratcher
Registered: 2012-11-25
Posts: 100+

Re: help with jumping for platformer game

Aditya007 wrote:

You can do this:
http://i48.tinypic.com/334r81l.gif

Last edited by Auto007 (2013-01-03 08:34:49)

Offline

 

#4 2013-01-03 08:36:37

Auto007
Scratcher
Registered: 2012-11-25
Posts: 100+

Re: help with jumping for platformer game

by Auto007 to Aditya007 wrote:

You can do this:

when gf clicked
forever
     if <[up arrow v] pressed?>
          change [y] by [15]
     end 
end
block errors are intentional, hope u still understand

About the signature of Aditya007

Offline

 

#5 2013-01-03 09:35:23

Sholvanic1058
Scratcher
Registered: 2012-04-21
Posts: 100+

Re: help with jumping for platformer game

This is what you need to do:


when gf clicked
forever if 
key [up arrow v] pressed?
change y by (10)
Sorry if it's incorrect! At least I have done better than the other ones.


http://i44.tinypic.com/2lj6o94.png

Offline

 

#6 2013-01-03 14:44:02

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: help with jumping for platformer game

None of these would work, since they'd simply move the character up, not down.
You want something like this

when gf clicked
forever
if <key [up arrow v] pressed?>
set [jumping v] to [1]
set [yvel v] to [10]
end
change y by (yvel)
change [yvel v] by [-1]
if <touching [ground v]?>
set [yvel v] to [0]
end
This is more psudocode than a working script, but it should show you what you need. Also in your original post, it said about moving in the air, if you have a simple left right moving script, and a "repeat" command for your jump, that will stop you miving while in the air.


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

Board footer