Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make collisions?
- JaycobCreator
-
16 posts
How to make collisions?
Well I'm making a platformer game and I'm trying to make collisions in my project. What do I do? 

- dragonsnake003
-
100+ posts
How to make collisions?
There is some different ways people go about this, but a great way is to make it is by pushing yourself out of a platform repeatedly until you are out of it. Put it in a custom block loop and run it without screen refresh, and it should work fine. Things are pretty easy from there. For a better explanation, see youtube.com/@griffpatch and find his first tutorial on how to code a classic platformer. Hope this helps! Well I'm making a platformer game and I'm trying to make collisions in my project. What do I do?
- Neometamarcel
-
1 post
How to make collisions?
I'm making a dark platformer game and I'm confused how to make collisions I tried every video how to make collisions in scratch and that didn't work for me
Seriously how can I make the collisions

Seriously how can I make the collisions
Last edited by Neometamarcel (Jan. 2, 2025 04:44:24)
- Nerdiesssss
-
100+ posts
How to make collisions?
There is some different ways people go about this, but a great way is to make it is by pushing yourself out of a platform repeatedly until you are out of it. Put it in a custom block loop and run it without screen refresh, and it should work fine. Things are pretty easy from there. For a better explanation, see youtube.com/@griffpatch and find his first tutorial on how to code a classic platformer. Hope this helps! Well I'm making a platformer game and I'm trying to make collisions in my project. What do I do?
Here is an example hope it helps!
- DidntMeanToDoThat
-
500+ posts
How to make collisions?
Let's say you have a sprite, which you want to have collisions with. To start with this method, you will need to make the player change direction depending on which way it's moving. The following code is an example of what the code could be in the player sprite (with WASD controls):
It's important to note with this method that firstly, if you have a jumping system, when the player character is falling back down you will have to make the sprite face down (180), and second of, if you have a player character that isn't just a ball, then it will of course rotate visually as well when it changes direction. A solution for this is to have an invisible “player guide” sprite that does all the movement, that the main player sprite with all the visuals constantly teleports to. If you need more info and examples, let me know. Next, put this code in the player sprite (this is what will actually do the collisions):
You can change the number of steps in the
block if it's to slow. For example,
would be faster than
If you have any questions, let me know. I haven't done much work with collisions, but this should work.
Last edited by DidntMeanToDoThat (Jan. 2, 2025 06:34:21)
- DragonPlusMaster
-
100+ posts
How to make collisions?
This just supplies the code for when you touch the wall, but not the movement code itself. For the movement code, instead of moving two steps, you change the variables x and y appropriately. If this is too confusing, I can help explain a little more clearer. I've seen people handle collisions something like this:

Last edited by DragonPlusMaster (Jan. 2, 2025 21:25:26)
- Mynxus
-
10 posts
How to make collisions?
(#5)
Let's say you have a sprite, which you want to have collisions with. To start with this method, you will need to make the player change direction depending on which way it's moving. The following code is an example of what the code could be in the player sprite (with WASD controls):It's important to note with this method that firstly, if you have a jumping system, when the player character is falling back down you will have to make the sprite face down (180), and second of, if you have a player character that isn't just a ball, then it will of course rotate visually as well when it changes direction. A solution for this is to have an invisible “player guide” sprite that does all the movement, that the main player sprite with all the visuals constantly teleports to. If you need more info and examples, let me know. Next, put this code in the player sprite (this is what will actually do the collisions):You can change the number of steps in theblock if it's to slow. For example,would be faster thanIf you have any questions, let me know. I haven't done much work with collisions, but this should work.
(#6)just by the way, this post is 8 months old.This just supplies the code for when you touch the wall, but not the movement code itself. For the movement code, instead of moving two steps, you change the variables x and y appropriately. If this is too confusing, I can help explain a little more clearer. I've seen people handle collisions something like this:
- DragonPlusMaster
-
100+ posts
How to make collisions?
just by the way, this post is 8 months old.
Oh oops lol
I see problem. I fix problem. XD
- DidntMeanToDoThat
-
500+ posts
How to make collisions?
Oh… why was this at the top of help with scripts when I saw it then? Anyways, nice reminder to check dates of posts. Oopsie.just by the way, this post is 8 months old.
Oh oops lol
I see problem. I fix problem. XD
Last edited by DidntMeanToDoThat (Jan. 2, 2025 23:05:21)
- DragonPlusMaster
-
100+ posts
How to make collisions?
I don't really think it was solved so at least we're helping lolOh… why was this at the top of help with scripts when I saw it then? Anyways, nice reminder to check dates of posts. Oopsie.just by the way, this post is 8 months old.
Oh oops lol
I see problem. I fix problem. XD
- DidntMeanToDoThat
-
500+ posts
How to make collisions?
Yeah, at least if someone stumbles across this while wondering about how to do collisions, they'll get some help. I have seen a lot of people ask about collisions. I don't really think it was solved so at least we're helping lol
- SAMSUNGGUY768
-
1 post
How to make collisions?
Last edited by SAMSUNGGUY768 (April 27, 2025 00:55:50)
- Discussion Forums
- » Help with Scripts
-
» How to make collisions?