Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with colisions
- M4YOMAN
-
Scratcher
19 posts
Help with colisions
I'm working on a platformer game, and I can't get collisions working. 
With something like one of my previous games, like smile man adventure, collisions are easy, because you play as a ball with a face.
With this game, you play as a rat with peppa pig arms. he just gets stuck in the walls.

With something like one of my previous games, like smile man adventure, collisions are easy, because you play as a ball with a face.
With this game, you play as a rat with peppa pig arms. he just gets stuck in the walls.
when green flag clicked
wait until <I receive help>
switch costume to [Happy]
repeat (too many times)
say [Thank you!] for (too long) secs
end
Last edited by M4YOMAN (Feb. 11, 2023 18:31:38)
- ItBeJC
-
Scratcher
1000+ posts
Help with colisions
Well, you could do this:
Make a rectangle around the whole player, and put it in a different costume. This will be the hitbox.
Then, you could do this:
Make a rectangle around the whole player, and put it in a different costume. This will be the hitbox.
Then, you could do this:
when green flag clicked
forever
switch costume to [Hitbox v]
Collision Scripts
switch costume to [Player v]
end
- M4YOMAN
-
Scratcher
19 posts
Help with colisions
Well, you could do this:I think I watched your video, but it may have been someone elses, and i tried it; and it didn't work. I don't know why, but it just didn't. Oh well.
Make a rectangle around the whole player, and put it in a different costume. This will be the hitbox.
Then, you could do this:when green flag clicked
forever
switch costume to [Hitbox v]
Collision Scripts
switch costume to [Player v]
end
- Sboosh_Kaboosh
-
Scratcher
100+ posts
Help with colisions
Easy fix, you need 2 sprites. A hitbox sprite with all the collisions scripts (from your other games) and a character sprite. The hitbox sprite is just a rectangle about the same size of your character.
Make the hitbox invisible,
then just make the character sprite forever go to the hitbox,
This should make the collision work fine.
Make the hitbox invisible,
when green flag clicked
set [ghost v] effect to (100)
then just make the character sprite forever go to the hitbox,
when green flag clicked
forever
go to [hitbox v]
end
This should make the collision work fine.

- Discussion Forums
- » Help with Scripts
-
» Help with colisions