Discuss Scratch

spidermask
Scratcher
53 posts

platformer script

i am trying to make a collision script with the ground it looks like this
when green flag clicked
if <touching [ level] ?> then
change y by (2)
end

Last edited by spidermask (Jan. 7, 2024 01:09:19)

knightjj11
Scratcher
100+ posts

platformer script

Sadly, I do not know how to explain the process of making a game with collision, but you can use various sources.
Here is one of them that will expand your knowledge.
spidermask
Scratcher
53 posts

platformer script

what is that image?
knightjj11
Scratcher
100+ posts

platformer script

spidermask wrote:

what is that image?

It was me 9 years ago.
SuperGamer474
Scratcher
50 posts

platformer script

spidermask wrote:

i am trying to make a collision script with the ground it looks like this
when green flag clicked
if <> then
change y by (2)
end
To add a collision to a floor with a single colour, you can do this:
when green flag clicked
if <touching color [Floor colour] ?> then
change y by (2)
end
Eason_9
Scratcher
1000+ posts

platformer script

There's a lot of ways to do that, I recommend using speed variables for collisions:

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-2] // gravity
change y by (speed y)
collide

define collide
if <touching [level v]> then
change y by ((0) - (speed y))
end

Remember to tick “Run without screen refresh” when you create the “collide” block
DogeMeowy
Scratcher
100+ posts

platformer script

Eason_9 wrote:

There's a lot of ways to do that, I recommend using speed variables for collisions:

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-2] // gravity
change y by (speed y)
collide

define collide
if <touching [level v]> then
change y by ((0) - (speed y))
end

Remember to tick “Run without screen refresh” when you create the “collide” block
Ok
spidermask
Scratcher
53 posts

platformer script

Eason_9 wrote:

There's a lot of ways to do that, I recommend using speed variables for collisions:

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-2] // gravity
change y by (speed y)
collide

define collide
if <touching [level v]> then
change y by ((0) - (speed y))
end

Remember to tick “Run without screen refresh” when you create the “collide” block
that will make my sprite fly up
knightjj11
Scratcher
100+ posts

platformer script

-mistake-

Last edited by knightjj11 (Jan. 7, 2024 03:48:13)

knightjj11
Scratcher
100+ posts

platformer script

spidermask wrote:

Eason_9 wrote:

There's a lot of ways to do that, I recommend using speed variables for collisions:

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-2] // gravity
change y by (speed y)
collide

define collide
if <touching [level v]> then
change y by ((0) - (speed y))
end

Remember to tick “Run without screen refresh” when you create the “collide” block
that will make my sprite fly up

Try this way.

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-1] // gravity
change y by (speed y)
collide

define collide
repeat until <not <touching [ level] ?>>
change y by (1)
set [ speed y] to [0]
spidermask
Scratcher
53 posts

platformer script

knightjj11 wrote:

spidermask wrote:

Eason_9 wrote:

There's a lot of ways to do that, I recommend using speed variables for collisions:

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-2] // gravity
change y by (speed y)
collide

define collide
if <[2] < [2]> then
change y by ((0) - (speed y))
end

Remember to tick “Run without screen refresh” when you create the “collide” block
that will make my sprite fly up

Try this way.

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-1] // gravity
change y by (speed y)
collide

define collide
repeat until <not <touching [ level] ?>>
change y by (1)
set [ speed y] to [0]
ok well then
spidermask
Scratcher
53 posts

platformer script

spidermask wrote:

knightjj11 wrote:

spidermask wrote:

Eason_9 wrote:

There's a lot of ways to do that, I recommend using speed variables for collisions:

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-2] // gravity
change y by (speed y)
collide

define collide
if <[2] < [2]> then
change y by ((0) - (speed y))
end

Remember to tick “Run without screen refresh” when you create the “collide” block
that will make my sprite fly up
try more loser

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-1] // gravity
change y by (speed y)
collide

define collide
repeat until <not <touching [ level] ?>>
change y by (1)
set [ speed y] to [0]
ok well then
]'
?
spidermask
Scratcher
53 posts

platformer script

Eason_9 wrote:

There's a lot of ways to do that, I recommend using speed variables for collisions:

when green flag clicked
set [speed y v] to [0]
forever
change [speed y v] by [-2] // gravity
change y by (speed y)
collide

define collide
if <touching [level v]> then
change y by ((0) - (speed y))
end

Remember to tick “im such a loser” when you create the “collide” block

Last edited by spidermask (Jan. 9, 2024 18:20:15)

knightjj11
Scratcher
100+ posts

platformer script

Sorry, but please do not post random things in the forums that other people did not say.

Powered by DjangoBB