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

#1 2011-11-25 16:53:20

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

How Do you only jump once?!

Hello, and thanks for reading. I'mmaking a platform game and i've done everything properly so far, but the only thing wrong is that when i press space quickly or hold it, i just float to the top of the screen (i have gravity so i do go back down). How do i make it so i can only jump once ( e.g. i cant jump while not touching the floor). Thanks for your time!

Offline

 

#2 2011-11-25 17:07:09

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

Re: How Do you only jump once?!

Try this:

When green flag clicked
Forever
If key [whatever key used to jump] pressed    and    touching colour [colour of ground]
Jumping script
End if
End forever

The 'touching colour [colour of ground]' is the important bit, as it means that unless the boolean is true, it won't be able to jump.

I hope this helped!  wink


Why

Offline

 

#3 2011-11-25 17:07:51

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

Re: How Do you only jump once?!

I'll try it out! Thanks

Offline

 

#4 2011-11-25 17:17:42

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

Re: How Do you only jump once?!

Glad I could help  smile


Why

Offline

 

#5 2011-11-25 17:19:15

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

Re: How Do you only jump once?!

Sorry to sound stupid, but where do you find end if and end forever?

Offline

 

#6 2011-11-25 17:22:27

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

Re: How Do you only jump once?!

Wow, that was stupid and sorry to say but it doesn't work.  sad

Offline

 

#7 2011-11-25 17:24:17

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

Re: How Do you only jump once?!

They're not actual blocks, it's just it's quite hard to say the scripts using text. You see the 'if' block in control? Well, it's kind of a 'c' shape. The bottom bit of the if is what I'm referring to, and the same for forever.  smile


Why

Offline

 

#8 2011-11-25 17:27:27

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

Re: How Do you only jump once?!

Could you possibly upload the projects you have so we can see why it isn't working then? There's probably another script somewhere counterracting it  hmm


Why

Offline

 

#9 2011-11-25 17:28:36

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

Re: How Do you only jump once?!

i've now got
When green flag clicked
if <touching colour green>
if <space key pressed>
change y by 20
end if
end if

Offline

 

#10 2011-11-25 17:32:00

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

Re: How Do you only jump once?!

i've uploaded it

Offline

 

#11 2011-11-25 17:39:04

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: How Do you only jump once?!

This works, and it also creates a smooth jump. Be sure to copy it EXACTLY, though. And change the color black to whatever color the ground is. If it jumps too high make the number 15 lower, and if it jumps too low, make the number 15 higher.

http://i40.tinypic.com/ok2a0w.gif


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#12 2011-11-25 17:58:20

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

Re: How Do you only jump once?!

It's working now, thanks!

Offline

 

#13 2011-11-25 18:00:49

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: How Do you only jump once?!

Trone789 wrote:

It's working now, thanks!

Were you talking to me?


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#14 2011-11-25 18:04:12

Trone789
New Scratcher
Registered: 2011-11-25
Posts: 8

Re: How Do you only jump once?!

yeah thanks.  smile

Offline

 

#15 2011-11-25 18:16:45

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: How Do you only jump once?!

You're very welcome!


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

Board footer