Discuss Scratch

1Sam87
Scratcher
38 posts

Let's make a platformer!




1st step: create two sprites

create an obstacle

PS!: Make sure every sprite in the center of the editor and X and y to 0 for Obstacles and Platformer,
Design the levels how you like it.

Setting up.
2nd step :
Create variables Xv and Yv




Sideways movement
Step3:

we multiply because:let's say xv = 1.
1 * 0.9 = 0.9
0.9 * 0.9 = 0.81
0.81 * 0.9 = 0.729
Therefore, xv keeps
decreasing until
it is 0.
so, smooth motion occurs, and sprite moves
a little even when the key is not pressed
These are mobile-friendly scripts. After this, your sprite will move left and right.

Sensing obstacles
Step4:

this script senses
the ground and
always keeps the
sprite above the
ground and this script senses
an obstacle and
causes a backward
movement.

Wall jump
Step4.1:

add this just after the last script like this:

On ground
Step 6:

this part is
very important
to understand.
gravity increases
as it gets added
on, if we're touching
the ground, lift
the player up and
stop gravity.

Finishing touch
Step7:
Make variable “Level”


Level change

Obstacles like spikes and lava.

Add this code to the obstacles and platform sprite.
Choose a unique title and Voila!
Ready to be shared.




What are you waiting for? Get coding and Scratch on!

Codes by 1Sam87 and superstarcoder©

Last edited by 1Sam87 (April 30, 2021 06:53:32)


RadTBNRFragz
Scratcher
10 posts

Let's make a platformer!

Nice! This has helped me!

RadTBNRFragz

Check me out here!
wangat
Scratcher
1000+ posts

Let's make a platformer!

How is this supposed to make you a wiki contributor? https://scratch.mit.edu/users/wangat/#comments-137490108

Happy Pride Month! Anyway, more stuff below! Highlight this and hold shift + down arrow!


(signature archived by kaj)
Happy Pride Month! Anyway, more stuff below! Highlight this and hold shift + down arrow!


About Me
Hi! I'm wangat!

I am a…

SWC Reviewer
SDS Helper
Forum Helper
Scratch Wiki Editor
FPCAH Curator
PPTBF Curator

1.3K+/1.5K forums posts! (last updated June 1st, 5:48 PM EST by wangat)


Me on the Forums

I'm quite active on the forums, posting 10+ posts a day. You can usually find me in the Questions about Scratch and the Suggestions forums.
_________

Thanks for checking out my signature! Hope to see you in the forums too!



Last edited by kaj (Janumaremberlytober, 66, 2066)
Penal_Fun
Scratcher
3 posts

Let's make a platformer!

turn cw (4) degrees
if <key [ v] pressed?> then
pen up
end
yishai8
Scratcher
2 posts

Let's make a platformer!

when green flag clicked
pen up
pen down
forever
ask [hello] and wait
end
1Sam87
Scratcher
38 posts

Let's make a platformer!

yishai8 wrote:

when green flag clicked
pen up
pen down
forever
ask [hello] and wait
end
hi

wangat
Scratcher
1000+ posts

Let's make a platformer!

Penal_Fun wrote:

turn cw (4) degrees
if <key [ v] pressed?> then
pen up
end

yishai8 wrote:

when green flag clicked
pen up
pen down
forever
ask [hello] and wait
end
Make sure not to blockspam!

Happy Pride Month! Anyway, more stuff below! Highlight this and hold shift + down arrow!


(signature archived by kaj)
Happy Pride Month! Anyway, more stuff below! Highlight this and hold shift + down arrow!


About Me
Hi! I'm wangat!

I am a…

SWC Reviewer
SDS Helper
Forum Helper
Scratch Wiki Editor
FPCAH Curator
PPTBF Curator

1.3K+/1.5K forums posts! (last updated June 1st, 5:48 PM EST by wangat)


Me on the Forums

I'm quite active on the forums, posting 10+ posts a day. You can usually find me in the Questions about Scratch and the Suggestions forums.
_________

Thanks for checking out my signature! Hope to see you in the forums too!



Last edited by kaj (Janumaremberlytober, 66, 2066)
1Sam87
Scratcher
38 posts

Let's make a platformer!

1Sam87 wrote:




1st step: create two sprites

create an obstacle

PS!: Make sure every sprite in the center of the editor and X and y to 0 for Obstacles and Platformer,
Design the levels how you like it.

Setting up.
2nd step :
Create variables Xv and Yv




Sideways movement
Step3:

we multiply because:let's say xv = 1.
1 * 0.9 = 0.9
0.9 * 0.9 = 0.81
0.81 * 0.9 = 0.729
Therefore, xv keeps
decreasing until
it is 0.
so, smooth motion occurs, and sprite moves
a little even when the key is not pressed
These are mobile-friendly scripts. After this, your sprite will move left and right.

Sensing obstacles
Step4:

this script senses
the ground and
always keeps the
sprite above the
ground and this script senses
an obstacle and
causes a backward
movement.

Wall jump
Step4.1:

add this just after the last script like this:

On ground
Step 6:

this part is
very important
to understand.
gravity increases
as it gets added
on, if we're touching
the ground, lift
the player up and
stop gravity.

Finishing touch
Step7:
Make variable “Level”


Level change

Obstacles like spikes and lava.

Add this code to the obstacles and platform sprite.
Choose a unique title and Voila!
Ready to be shared.




What are you waiting for? Get coding and Scratch on!

Codes by 1Sam87 and superstarcoder©

Powered by DjangoBB

Standard | Mobile