Discuss Scratch

D3STR0Y3R1
Scratcher
21 posts

How do i make a "platformer"

So how do I make it to where the sprite doesnt just phase through the platforms and actually stays on and able to jump to different platforms?
NeonG4
Scratcher
1000+ posts

How do i make a "platformer"

D3STR0Y3R1 wrote:

So how do I make it to where the sprite doesnt just phase through the platforms and actually stays on and able to jump to different platforms?
With something as big as a platformer game, you should use a tutorial. I would recommend @griffatch's platform tutorial.
CatU38
Scratcher
42 posts

How do i make a "platformer"

you can search some tutorials or templates in scratch, But in case you will need:
A Player Sprite
A Hitbox Sprite
And a Ground Sprite

Example Script for Hitbox (Not Working):
when I receive [Start v]
show
set size to (100) %
go to front
forever
Move
end

define Move
if <<key [right arrow v] pressed?> or <key [ d] pressed?>> then
repeat until <<key [right arrow v] pressed?> or <key [d v] pressed?>>

change x by (10)


else

end

Obviously, I'm not an expert in scrolling platformers so you could use some tutorials at your own way and learn from those tutorials

I hope you find the right way to do it

Last edited by CatU38 (May 26, 2023 16:41:56)

NeonG4
Scratcher
1000+ posts

How do i make a "platformer"

CatU38 wrote:

you can search some tutorials or templates in scratch, But in case you will need:
A Player Sprite
A Hitbox Sprite
And a Ground Sprite

Example Script for Hitbox (Not Working):
when I receive [Start v]
show
set size to (100) %
go to front
forever
Move
end

define Move
if <<key [right arrow v] pressed?> or <key [ d] pressed?>> then
repeat until <<key [right arrow v] pressed?> or <key [d v] pressed?>>

change x by (10)


else

end

Obviously, I'm not an expert in scrolling platformers so you could use some tutorials at your own way and learn from those tutorials

I hope you find the right way to do it
You most likely wouldn't want the hitbox to be a separate sprite.
--Robinflight--
Scratcher
40 posts

How do i make a "platformer"

D3STR0Y3R1 wrote:

So how do I make it to where the sprite doesnt just phase through the platforms and actually stays on and able to jump to different platforms?
A good idea would be to simplify it down so it isn't really complicated. All you need is a ‘Level’ sprite and to use the ‘if touching <Level>’ block. I think the simplest way to do this is:
if <touching [Level v] ?> then
set x to (x position)
set y to (y position)
end
This might not work and/or be really glitchy, but give it a try and mould your ideas around that
Hope that doesn't sound too confusing or weird
–Robinflight–
--Robinflight--
Scratcher
40 posts

How do i make a "platformer"

--Robinflight-- wrote:

D3STR0Y3R1 wrote:

So how do I make it to where the sprite doesnt just phase through the platforms and actually stays on and able to jump to different platforms?
A good idea would be to simplify it down so it isn't really complicated. All you need is a ‘Level’ sprite and to use the ‘if touching <Level>’ block. I think the simplest way to do this is:
if <touching [Level v] ?> then
set x to (x position)
set y to (y position)
end
This might not work and/or be really glitchy, but give it a try and mould your ideas around that
Hope that doesn't sound too confusing or weird
–Robinflight–
Also, if it does work, be careful not to mix up the ‘go to’ motion block with the blocks I mentioned. This may not be a problem but it was for me…
NeonG4
Scratcher
1000+ posts

How do i make a "platformer"

--Robinflight-- wrote:

snip
Hey @–Robinflight–,
If you set x to x position, that does next to nothing*. (Same goes with the set y to y position). If you aren't sure, run a test case.
say x position is 47, and the player is touching the level.
if <touching [level v] ?> then  // check passed! 
set x to (x position) // if xpos = 47, then we just set the x position to 47.
... // same for y
end
we can see that it doesn't seem to change the position at all.

*The 2 blocks will delay the stack 1 frame, by about 0.03 seconds.
--Robinflight--
Scratcher
40 posts

How do i make a "platformer"

Oh okay, never mind then
–Robinflight–
drsmith86
Scratcher
9 posts

How do i make a "platformer"

hey just follow griffpatchs tutorial on how to make a platformer
nebgenius
Scratcher
14 posts

How do i make a "platformer"


when green flag clicked
forever
change y by (-10
end

when green flag clicked
forever
if <touching ground> then

change y by (10)

when green flag clicked
forever

if <up arrow> then
change y by (20)

Last edited by nebgenius (Jan. 14, 2025 13:46:09)

babyastation
Scratcher
1 post

How do i make a "platformer"

what is the dark red up arrow block from
OriginalLion123
Scratcher
25 posts

How do i make a "platformer"

I tried doing something and it didn't work
nebgenius
Scratcher
14 posts

How do i make a "platformer"

babyastation wrote:

what is the dark red up arrow block from


it is this
<key [ up arrow] pressed?>

Last edited by nebgenius (Oct. 31, 2025 15:47:31)

Hi_Pro20155
Scratcher
5 posts

How do i make a "platformer"

JamesTheCoder1234
Scratcher
5 posts

How do i make a "platformer"

You need:
A player,
A player hit box,
and a ground sprite.
and all the code down below

Last edited by JamesTheCoder1234 (Dec. 7, 2025 10:01:34)

year3klee
Scratcher
1 post

How do i make a "platformer"

Does anyone know how to code a scrolling platformer? is it
(camera x)
insaid of
change x by (10)
nebgenius
Scratcher
14 posts

How do i make a "platformer"

year3klee wrote:

Does anyone know how to code a scrolling platformer? is it
(camera x)
insaid of
change x by (10)


yes
OriginalLion123
Scratcher
25 posts

How do i make a "platformer"

nebgenius wrote:

year3klee wrote:

Does anyone know how to code a scrolling platformer? is it
(camera x)
insaid of
change x by (10)


yes
I will very much use that

Powered by DjangoBB