Hi.
I would like to know how to make good games! Could someone please answer these questions?
How do you make smooth jumping?
How do you make stand-on-able platforms?
Thanks!
-Hoopla
Offline
Thanks!
Offline
To start, we want to be able to use velocity, which will be using these scripts here:
[blocks]
make a variable called "velocityY"
<when green flag clicked>
<forever>
<if><< <not> >><touching[ ground color/ground sprite>
<change{ <{ velocityY }> }by( -0.1 )> (you can alter the number to make him jump higher/lower
<end>
<if><touching[ ground color/ground sprite>
<set{ velocityY }to( 0.1
<end>
<end>
This will simply give you... nothing. To add functionality to our velocity, just use this:
<when green flag clicked>
<forever>
<change y by( velocityY
<end>
<end>
That should just make us not go through a platform and make us fall if we are not touching the ground sprite. To truly add functionality to our velocity, simply add the script to the sprite:
<when green flag clicked>
<forever>
<if><touching[ ground color/ground sprite>
<if> <key[ space/up arrow ]pressed?>
<set{ velocityY }to( 8 (you can change to make him jump higher/lower.
[/blocks]
That should work, and if it doesn't, just tell me and I'll see what's wrong!
Offline
Offline
this should be in the all about scratch forum, not here
Offline
To prevent the sprite from sinking into a platform use this script
<when green flag clicked>
<forever>
<if><touching color[ Platform color
<change y by( 1 )
<end>
<end>
Last edited by geckofreak (2008-06-05 16:03:43)
Offline
You also might want to improve your motion scripts:
<when green flag clicked>
<forever>
<if><key[ right arrow ]pressed?>
<point in direction( right )
<change x by( 3 )
<else>
<if><key[ left arrow ]pressed?>
<point in direction( left )
<change x by( -3 )
<end>
<end>
<end>
Last edited by geckofreak (2008-06-05 16:02:26)
Offline
geckofreak wrote:
You also might want to improve your motion scripts:
<when green flag clicked>
<forever>
<if><key[ right arrow ]pressed?>
<point in direction( right )
<change x by( 3 )
<else>
<if><key[ left arrow ]pressed?>
<point in direction( left )
<change x by( -3 )
<end>
<end>
<end>
I fixed it
Offline
If you want smooth jumping you don't need velocity. You can use this:
<when green flag clicked>
<forever>
<if><key[ up arrow ]pressed?>
<set{ Jumping }to( 1 )
<repeat( 4 times )
<change y by( 2 )
<end>
<repeat( 6 times )
<change y by( 4 )
<end>
<repeat( 10 times )
<change y by( 6 )
<end>
<repeat until> <touching color[ platform color
<change y by( -5 )
<end>
<end>
<end>
Offline
geckofreak wrote:
If you want smooth jumping you don't need velocity. You can use this:
<when green flag clicked>
<forever>
<if><key[ up arrow ]pressed?>
<set{ Jumping }to( 1 )
<repeat( 4 times )
<change y by( 2 )
<end>
<repeat( 6 times )
<change y by( 4 )
<end>
<repeat( 10 times )
<change y by( 6 )
<end>
<repeat until> <touching color[ platform color
<change y by( -5 )
<end>
<end>
<end>
But my system merges both of her questions together. Plus, I tried doing that once, it gets really quite blocky when jumping off high things.
Offline
You will also need to make the top line of the platforms a different color and use this script:
<when green flag clicked>
<forever>
<if> <not><touching color[ top line color ] >>
<if> <( <{ jumping }> <=> 0 )>
<repeat until><touching color[ top line color
<change y by( -5
<end>
<end>
<end>
<end>
Last edited by geckofreak (2008-06-05 17:32:29)
Offline
coolstuff wrote:
But my system merges both of her questions together. Plus, I tried doing that once, it gets really quite blocky when jumping off high things.
I'm a boy!!!!!
That's okay though, my user name doesn't suggest what gender I am.
Offline
Everyone seems to get genders wrong. Lets say, if your name is Bluestribute, your a boy, and everyone else if just "them"
Offline
Bluestribute wrote:
Everyone seems to get genders wrong. Lets say, if your name is Bluestribute, your a boy, and everyone else if just "them"
For some reason, I've always thought of you as a boy.
Offline
coolstuff wrote:
Bluestribute wrote:
Everyone seems to get genders wrong. Lets say, if your name is Bluestribute, your a boy, and everyone else if just "them"
For some reason, I've always thought of you as a boy.
Oh, but I Am
Offline
Geckofreak, I tried your procedure, but I think I may have messed up, because the sprite just floats in midair. I'm confused.
Offline
I fixed it and posted it as a project. I also fixed your level switching procedure. http://scratch.mit.edu/projects/geckofreak/181672
Offline