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

#1 2008-03-08 15:59:15

AllScratchedUp
Scratcher
Registered: 2008-01-20
Posts: 47

Jumping Help

I am trying to make a Mario-type game and I do not know how to make it so you can jump. PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


"Sometimes I lie awake at night, and I ask, "Where have I gone wrong?" Then a voice says to me, "This is going to take more than one night.""-Charles Schultz
http://smileyjungle.com/smilies/violent23.gif http://smileyjungle.com/smilies/celebrate3.gif

Offline

 

#2 2008-03-08 16:13:18

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Jumping Help

Check this project out  smile  http://scratch.mit.edu/projects/archmage/72848

It will give you jumping codes.

Last edited by archmage (2008-03-08 16:13:35)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#3 2008-03-08 16:19:27

AllScratchedUp
Scratcher
Registered: 2008-01-20
Posts: 47

Re: Jumping Help

I have dial-up internet which means that things load VERY slow. So I cannot download your project. Would you please show it to me on this forum? Also, how do you put smileys on your post?


"Sometimes I lie awake at night, and I ask, "Where have I gone wrong?" Then a voice says to me, "This is going to take more than one night.""-Charles Schultz
http://smileyjungle.com/smilies/violent23.gif http://smileyjungle.com/smilies/celebrate3.gif

Offline

 

#4 2008-03-08 16:23:40

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Jumping Help

<when green flag clicked>
<set{ yVelocity }to( 0
<forever>
<if> <touching[ ground
<set{ yVelocity }to( 1
<if> <key[ up arrow ]pressed?>
<set{ yVelocity  }to( 15
<end>
<end>
<change{ yVelocity }by( -1
<change y by( <{ yVelocity }>
<end>

For smilies see http://scratch.mit.edu/forums/help.php#smilies

Last edited by archmage (2008-03-08 16:24:25)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2008-03-08 16:29:11

AllScratchedUp
Scratcher
Registered: 2008-01-20
Posts: 47

Re: Jumping Help

Thanks a TON Archmage!!!!


"Sometimes I lie awake at night, and I ask, "Where have I gone wrong?" Then a voice says to me, "This is going to take more than one night.""-Charles Schultz
http://smileyjungle.com/smilies/violent23.gif http://smileyjungle.com/smilies/celebrate3.gif

Offline

 

#6 2008-03-08 16:34:22

AllScratchedUp
Scratcher
Registered: 2008-01-20
Posts: 47

Re: Jumping Help

cool


"Sometimes I lie awake at night, and I ask, "Where have I gone wrong?" Then a voice says to me, "This is going to take more than one night.""-Charles Schultz
http://smileyjungle.com/smilies/violent23.gif http://smileyjungle.com/smilies/celebrate3.gif

Offline

 

#7 2008-03-08 17:03:59

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Jumping Help

<when[ space ]key pressed>
<forever if><key[ space ]pressed?>
<point in direction( 0
<move( 10 )steps>
<wait( 0.00001 )secs>
<move( 9 )steps>
<wait( 0.00001 )secs>

etc, etc, til u get to 1 (miss out the wait after 1), then:

<wait( 2.5 )secs>
<point in direction( 180
<move( 1 )steps>
<wait( 0.00001 )secs>
<move( 2 )steps>
<wait( 0.00001 )secs>

etc, etc, til u get to 10 (miss out the wait after 10), then:

<wait( 1 )secs>    (if u want a delay after each jump, if u dont, type 0.01)
<end>

P.S. the mario must be either left/right or fixed. if the mario is free then this wont work and you'll end up with a fat-assed plumber landing on his head

PP.S. dont flame me for calling mario "fat-assed", flame the nintendo magazine

Last edited by teguki (2008-03-08 17:12:49)

Offline

 

#8 2008-03-08 17:37:55

AllScratchedUp
Scratcher
Registered: 2008-01-20
Posts: 47

Re: Jumping Help

Also,where is a good place to get Mario sprites? The one I'm using for some reason won't go into my scratch project.


"Sometimes I lie awake at night, and I ask, "Where have I gone wrong?" Then a voice says to me, "This is going to take more than one night.""-Charles Schultz
http://smileyjungle.com/smilies/violent23.gif http://smileyjungle.com/smilies/celebrate3.gif

Offline

 

#9 2008-03-08 18:10:36

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Jumping Help

use PNGs

Offline

 

#10 2008-03-08 18:22:43

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Jumping Help

For mario sprites go to http://www.spriters-resource.com/nintendo/mario/


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#11 2008-03-09 11:21:51

D97
Scratcher
Registered: 2007-12-22
Posts: 100+

Re: Jumping Help

Theres a very easy way to do it.
<when green flag clicked>
<forever if><  <not>  <touching[ ground>>>>
<change y by( 5 )
<end>

Last edited by D97 (2008-03-09 11:22:27)


Yes, I am still alive, and no, I am not GLADOS.
Join Sayonara, my Scratch games company!

Offline

 

#12 2008-03-10 13:57:48

D97
Scratcher
Registered: 2007-12-22
Posts: 100+

Re: Jumping Help

and to jump
<when green flag clicked>
<forever if><touching[ ground<<  <and>  >><key[ up arrow ]pressed?>
<repeat( 10 )
<change y by( 10 )


Yes, I am still alive, and no, I am not GLADOS.
Join Sayonara, my Scratch games company!

Offline

 

#13 2008-03-10 16:44:25

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Jumping Help

umm, thats going to end up with a mario hanging in mid-air, you havent said how to get him back down again

Offline

 

#14 2008-03-10 16:55:36

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Jumping Help

Read both of his posts, Teguki.  The first one is a simple approximation of gravity.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#15 2008-03-10 17:40:57

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Jumping Help

i still dont understand

Offline

 

#16 2008-03-11 01:58:26

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Jumping Help

The first script makes the character fall if he is not touching the ground.  The second script therefore only needs to take teh character up, he will come back down automatically.

***

Its not the best way of doing it, mind you, as the second script does not interupt the first script, so he will be rising and falling at the same time.  This has been overcome by making the amount he rises bigger, but there are better ways around it.

***

One way is by using acceleration and velocity.

You need a vertical velocity (Y-Velocity).

Your falling script, inside a loop, would be:

If touching ground
- - set (Y-Velocity) to 0
- ELSE
- - change (Y-Velocity) by -1
Change Y by (Y-Velocity) <-(not inside the "If", but sill inside the loop)

This makes the character fall, and the speed at which he falls gradullay increases.

Then your Jump button needs a script like:

If Key [up arrow] pressed AND (Y-Velocity)=0
- Set Y-Velocity to 5

This results in the character leaping upwards at a speed of 5 (because of the other script) but the speed at which he rises gradually decreases until he starts to fall again.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#17 2008-03-11 04:28:52

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Jumping Help

ah right, so the first post sould have said <change y by -5 > instead of five, or am i confuzed again

Offline

 

#18 2008-03-11 13:14:27

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Jumping Help

Good point - I didn't notice that  wink


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#19 2008-04-12 13:50:55

AllScratchedUp
Scratcher
Registered: 2008-01-20
Posts: 47

Re: Jumping Help

hey teguki, how do you change pictures into PNGS?


"Sometimes I lie awake at night, and I ask, "Where have I gone wrong?" Then a voice says to me, "This is going to take more than one night.""-Charles Schultz
http://smileyjungle.com/smilies/violent23.gif http://smileyjungle.com/smilies/celebrate3.gif

Offline

 

#20 2008-04-17 17:59:54

teguki
Scratcher
Registered: 2008-03-06
Posts: 72

Re: Jumping Help

pixilion image converter or similar program, but you should have posted this in a new topic

Offline

 

Board footer