Discuss Scratch

_Crystalwolf_
Scratcher
2 posts

How do you make a sprite jump?

I'm making a platformer and can't seem to get this aspect of my codeing right, anyone know how i can make a sprite jump?
-Squiggle
Scratcher
500+ posts

How do you make a sprite jump?

If you use a standard platformer script, it should automatically include jumping, and a smooth glide when moving.
But, if you are starting from scratch with no premade scripts, I'd be interested to see what you've created so far!
Could I see your project so I can get a better idea of what's going on and how to fix it?
FlaBERgUsgET
Scratcher
26 posts

How do you make a sprite jump?

Thank You For Reading! Please Check Out My Platformers When You Are Done… I worked 30 minutes on this so PLEASE READ CAREFULLY! The Main way is to make gravity positive (I think of it as ‘falling upward’) and then the gravity slowly pulls you down.
Here is the main way (using the @griffpatch method):

whenIreceiveLevel StartsetSYto0setIn Airto0forever:TickdefineTick:#Note:Check'RunWithoutscreenrefresh'ifkeyleft arrowpressed?then:MoveLeftControlifkeyright arrowpressed?then:MoveRightControlifkeyup arrowpressed?then:ifInAir<4then:setSYto16changeSYby-2#MakeABlockHererunwithoutscreenrefresh:ChangePlayerYBy:SYdefineChangePlayerYBy:SYChangeYbySYChangeIn Airby1repeatuntiltouchingPlatform?IfSY>0then:ChangeYby-1Else:ChangeYby1SetIn Airto0SetSYto0

If This is too complicated, I suggest watching the @griffpatch videos on scrolling platformers, but leaving out the ‘SCROLL X & SCROLL Y variables’

My Games:
|Eclipse| - A Mobile Friendly Platformer: https://scratch.mit.edu/projects/402840432/
Hero's Quest- A Scrolling Platformer: https://scratch.mit.edu/projects/401400653/
NIGHT- An Infinite Scrolling Platformer: https://scratch.mit.edu/projects/386371856/
Cookie Clicker: https://scratch.mit.edu/projects/388016658/
Scrolling Helicopter Pilot: https://scratch.mit.edu/projects/408517610/
mrkeith101
Scratcher
500+ posts

How do you make a sprite jump?

whenupkeypressedrepeat50changeyby10repeat50changeyby-10
mrkeith101
Scratcher
500+ posts

How do you make a sprite jump?

hope this helps
ScratchCatHELLO
Scratcher
1000+ posts

How do you make a sprite jump?

mrkeith101 wrote:

whenupkeypressedrepeat50changeyby10repeat50changeyby-10

That's not really gravity and doesn't allow collisions or rough terrain
ScratchCatHELLO
Scratcher
1000+ posts

How do you make a sprite jump?

FlaBERgUsgET wrote:

Thank You For Reading! Please Check Out My Platformers When You Are Done..

advertise much? XD

My Games:
|Eclipse| - A Mobile Friendly Platformer: https://scratch.mit.edu/projects/402840432/
Hero's Quest- A Scrolling Platformer: https://scratch.mit.edu/projects/401400653/
NIGHT- An Infinite Scrolling Platformer: https://scratch.mit.edu/projects/386371856/
Cookie Clicker: https://scratch.mit.edu/projects/388016658/
Scrolling Helicopter Pilot: https://scratch.mit.edu/projects/408517610/

I thought this was a signature at first, but no… you were actually desperate enough to write that entire part out just for this topic.

(slow clap)

ANYWAY…

Griffpatch's platformer tutorial is pretty good, and I'm pretty sure there's a wiki article on how to make a platformer script
_Crystalwolf_
Scratcher
2 posts

How do you make a sprite jump?

Thank you all for your help! to the person who asked to see my project to see whats wrong i'll finish one peice of code then give it to you on your profile page

Powered by DjangoBB