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

#1 2010-06-04 07:55:48

WhiteStone
Scratcher
Registered: 2010-06-04
Posts: 7

How do you make other "grounds" work?

In my project, I've got the jumping down so that the sprite doesn't fall through, and the running part as well. So how would I make that work for another platform that the sprite would jump up on to? Or better yet, jump through it and then when the sprite lands on the new platform it would stop.

I just need the script for this, that would be very helpful. I don't really have time to look through 100 pages of forums, so if there is already a post could you please send me a link to it?

Offline

 

#2 2010-06-04 09:17:14

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: How do you make other "grounds" work?

http://i45.tinypic.com/4zutzq.gif

I hope this helped!

Offline

 

#3 2010-06-04 09:25:34

06dknibbs
Scratcher
Registered: 2008-01-29
Posts: 1000+

Re: How do you make other "grounds" work?

Edit: Nevermind xD

^ That post should work anyway  smile

Last edited by 06dknibbs (2010-06-04 09:26:44)


http://i404.photobucket.com/albums/pp129/06dknibbs/Untitled-3-6.jpg

Offline

 

#4 2010-06-04 09:44:50

WhiteStone
Scratcher
Registered: 2010-06-04
Posts: 7

Re: How do you make other "grounds" work?

Well actually or the jump script I'm using the custom variable y velocity:
<when green flag clicked>
<set{ y velocity }to( 0
<forever>
<if><touching[ Sprite 2
<set{ y velocity }to( 0
<if><key[ up arrow ]pressed?>
<set{ y velocity }to( 15
<change y by( <{ y velocity }>
<change{ y velocity }by( -1
Something like that. But yeah, that's what I'm using to jump. Would it be much different using that script?

Last edited by WhiteStone (2010-06-04 09:51:52)

Offline

 

#5 2010-06-04 11:27:53

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: How do you make other "grounds" work?

I was considering using velocity and gravity, but I decided to keep it simple. You would have to make a few adaptations, but the basic script and idea would be the same. I'm sure you can figure it out.  smile

By the way, I would suggest using
[blocks]
<set{ y velocity }to( (( <{ y veloicty }> <*> 0.9 ))
[/blocks]
instead of
[blocks]
<change{ velocity }by( -1
[/blocks]

It may not make things easier in this case, but it will help later on.

Offline

 

#6 2010-06-04 12:39:22

Subh
Scratcher
Registered: 2010-05-25
Posts: 100+

Re: How do you make other "grounds" work?

http://scratch.mit.edu/projects/Subh2/1099515

I could not take a screenshot so I uploaded the project


http://wiki.scratch.mit.edu/skins/scratch/logo.png     I'M IN Scratch Wiki .... ARE YOU ????

Offline

 

#7 2010-06-04 21:14:41

WhiteStone
Scratcher
Registered: 2010-06-04
Posts: 7

Re: How do you make other "grounds" work?

shadow_7283 wrote:

By the way, I would suggest using
[blocks]
<set{ y velocity }to( (( <{ y veloicty }> <*> 0.9 ))
[/blocks]
instead of
[blocks]
<change{ velocity }by( -1
[/blocks]

Problem with that is that it doesn't make the sprite fall, it'll only continually decrease the y velocity so it will continue to go up at a decreasing interval.

But actually, I figured out how to do it on my own.  smile
<when green flag clicked>
<forever>
<if><< <touching[ Platform 1 <and> <( <{ y velocity }> <<> 1 )> >>
<set{ y velocity }to( 0
   <if><key[ up arrow ]pressed?>
   <set{ y velocity }to( 15
So, the sprite can only be on the platform if it is falling, which means it can jump through them, and it is able to jump off of it. Since the jump is specific to each platform, it makes it much easier to manipulate all the variables whenever needed.

And I managed to fix one of my own glitches, yes I am very proud of myself.

Offline

 

Board footer