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

#1 2012-06-06 03:43:45

scrin445
New Scratcher
Registered: 2012-05-24
Posts: 9

How do I do this?

I want to make a jump script. As you jump higher, you go slower until you stop and fall faster the more you fall. Remember, I'm a new Scratcher.

Offline

 

#2 2012-06-06 04:17:38

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: How do I do this?

Okay, I'll explain this as best I can.

Do you know what variables are?
Go to variables, click on "create new variable", and type in "yvel" in the box. Click OK, and now, you should see a reporter block with "yvel" written on it. Drag it out, we will be using it.

Use these scripts:

when gf clicked
forever
 if <touching [ground v]?> //Your ground.
  set [yvel v] to [0] //You can find this block in the variables section.
 else
  change [yvel v] by (-0.1) //You can find this block in the variables section.
 end
 change y by (yvel) //That "yvel" reporter block.
when gf clicked
forever
 if <<key [up arrow v] pressed?> and <touching [ground v]?>> //Your ground.
  set [yvel v] to [5] //Change this number higher for a higher jump.
  wait until <not <touching [ground v]?>> //Your ground.
 end
end

Last edited by SciTecCf (2012-06-06 04:20:34)


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#3 2012-06-06 06:31:56

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: How do I do this?

Good Explaination. Remember you could replace

<touching [ground v] ?>
with
<touching color [#000000] ?>//colour of ground
The first one will only work if the ground is a seperate sprite


http://i46.tinypic.com/ao03lk.png

Offline

 

#4 2012-06-06 09:13:20

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

Re: How do I do this?

Yes, good explanation! @scrin445 Scitec's script will work, but if you want the jump higher, or the person to fall faster from the sky, then change how much the variables increase or decrease by.


Why are the secret organizations getting all the attention?  mad

Offline

 

Board footer