Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » platformer script
- 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.
Here is one of them that will expand your knowledge.
- SuperGamer474
-
Scratcher
50 posts
platformer script
i am trying to make a collision script with the ground it looks like thisTo add a collision to a floor with a single colour, you can do this:when green flag clicked
if <> then
change y by (2)
end
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:
Remember to tick “Run without screen refresh” when you create the “collide” block
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
There's a lot of ways to do that, I recommend using speed variables for collisions:Okwhen 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
- spidermask
-
Scratcher
53 posts
platformer script
There's a lot of ways to do that, I recommend using speed variables for collisions:that will make my sprite fly upwhen 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
- knightjj11
-
Scratcher
100+ posts
platformer script
-mistake-
Last edited by knightjj11 (Jan. 7, 2024 03:48:13)
- knightjj11
-
Scratcher
100+ posts
platformer script
There's a lot of ways to do that, I recommend using speed variables for collisions:that will make my sprite fly upwhen 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
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
ok well thenThere's a lot of ways to do that, I recommend using speed variables for collisions:that will make my sprite fly upwhen 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
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
]'ok well thentry more loserThere's a lot of ways to do that, I recommend using speed variables for collisions:that will make my sprite fly upwhen 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” blockwhen 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
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.
- Discussion Forums
- » Help with Scripts
-
» platformer script