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

#1 2012-06-04 17:52:34

fetzer
Scratcher
Registered: 2009-06-11
Posts: 70

How to jump

As you have probally heard im making a game like *Red*, can someone please make me a script to jump? Or ATLEAST give me a proper explanation on how to do it?

Offline

 

#2 2012-08-08 10:49:33

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: How to jump

Here are some scripts that should help:

When gf clicked
forever
 If <<touching [ground v]?> and <key [up arrow v] pressed?>>
  set [y velocity v] to (5)//Edit this to change the height of your jump.
  wait until <not <touching [ground v]?>>
  wait until <touching [ground v]?>
 else
  if <touching [ground v]?>
   set [y velocity v] to (0)
  end
 end

When gf clicked
forever
 if <not <touching [ground v]?>>
  change [y velocity v] by (-.5)//Edit this to change the strength of gravity.
 end
 change y by (y velocity)
Note: You can replace
 <touching [ground v]?> 
with whatever you use to figure out if your character is on the ground or not. Also, this is just a simple jumping script where you can jump through platforms. If you don't want that to happen, or if you want a more realistic jump, just tell me and I will get you the scripts for that.

Anyway, I hope that this helps!

Last edited by ErnieParke (2012-08-08 10:59:45)


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2012-08-08 10:58:23

soniku3
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: How to jump

This belongs Here


internet's all about cats today.

Offline

 

Board footer