Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Collision detections; HOW??
- SuperWolf64
-
100+ posts
Collision detections; HOW??
Is there a way to make collision detection? I've attempted and the following is what happens:
1. Normally it works fine.Touching the color sends the plays back a little.
2. But if you go up to a wall, press L and R, you get sent through the wall like in the Super Mario Bros. Minus World glitch.
Since the game I'm making is a maze game, this easily allows cheating…
I've seen how to make collision in side-scrollers, but my game don't fit that category. In this game, when your reach a certain point, the level cycles in that direction, like in Nintendo's Metroid games. If you go to my game, then it'll show you the problem.
Click here to go to my game!
If you can find a solution, then help!
1. Normally it works fine.Touching the color sends the plays back a little.
2. But if you go up to a wall, press L and R, you get sent through the wall like in the Super Mario Bros. Minus World glitch.
Since the game I'm making is a maze game, this easily allows cheating…
I've seen how to make collision in side-scrollers, but my game don't fit that category. In this game, when your reach a certain point, the level cycles in that direction, like in Nintendo's Metroid games. If you go to my game, then it'll show you the problem.
Click here to go to my game!
If you can find a solution, then help!
- drmcw
-
1000+ posts
Collision detections; HOW??
The game doesn't work at all. Collision detection is no different to any other, in fact should be the easiest type as there is no jumping or gravity to worry about.
- Sssspppuud
-
20 posts
Collision detections; HOW??
Does anyone know how I could stop my sprite (square) getting stuck in the platforms!
https://scratch.mit.edu/projects/104278034/
https://scratch.mit.edu/projects/104278034/
- Paddle2See
-
1000+ posts
Collision detections; HOW??
It's best to make your own topic for your own issues. Look for the “New topic” button at the top of the “Help With Scripts” section Does anyone know how I could stop my sprite (square) getting stuck in the platforms!
https://scratch.mit.edu/projects/104278034/

- Starblox77
-
8 posts
Collision detections; HOW??
The best way to detect a collision between two sprites is to have speed variables attached to each sprite, for example
This is from the point of view of the Blue Car.
This is from the point of view of the Blue Car.
Last edited by Starblox77 (May 11, 2016 22:38:55)
- SuperWolf64
-
100+ posts
Collision detections; HOW??
It's not the detecting i'm having trouble with, it's what happens when the collision is detected. Nice idea, though. The best way to detect a collision between two sprites is to have speed variables attached to each sprite, for example
This is from the point of view of the Blue Car.
- SuperWolf64
-
100+ posts
Collision detections; HOW??
Well, my game is more along the lines of Legend of Zelda in screen scrolling/collision terms. Is there a way to make collision detection? I've attempted and the following is what happens:
1. Normally it works fine.Touching the color sends the plays back a little.
2. But if you go up to a wall, press L and R, you get sent through the wall like in the Super Mario Bros. Minus World glitch.
Since the game I'm making is a maze game, this easily allows cheating…
I've seen how to make collision in side-scrollers, but my game don't fit that category. In this game, when your reach a certain point, the level cycles in that direction, like in Nintendo's Metroid games. If you go to my game, then it'll show you the problem.
Click here to go to my game!
If you can find a solution, then help!
- _Cookinator924_
-
1 post
Collision detections; HOW??
Okay, so I think I know what you are saying, but forgive me if this doesn't help you at all.
You probably have a code like “Forever: If right arrow pressed then move right, if left arrow pressed then move left, etc. Well, to make your character not pass through walls, you should add a piece of code after each ”move“ block: If touching wall then move negative the distance you moved first. For example, if you change x by three each time the right arrow key is pressed, then the sprite touches a wall, it should change x by -3. Remember to keep that code in the ”if right arrow key pressed". This gives it smooth movement against walls and happens so fast nobody will notice it. I hope this helps (because I'm horrible at explaining things), and you can always reply if you still don't understand.
You probably have a code like “Forever: If right arrow pressed then move right, if left arrow pressed then move left, etc. Well, to make your character not pass through walls, you should add a piece of code after each ”move“ block: If touching wall then move negative the distance you moved first. For example, if you change x by three each time the right arrow key is pressed, then the sprite touches a wall, it should change x by -3. Remember to keep that code in the ”if right arrow key pressed". This gives it smooth movement against walls and happens so fast nobody will notice it. I hope this helps (because I'm horrible at explaining things), and you can always reply if you still don't understand.

- -XPT-
-
4 posts
Collision detections; HOW??
Okay, so I think I know what you are saying, but forgive me if this doesn't help you at all.
You probably have a code like “Forever: If right arrow pressed then move right, if left arrow pressed then move left, etc. Well, to make your character not pass through walls, you should add a piece of code after each ”move“ block: If touching wall then move negative the distance you moved first. For example, if you change x by three each time the right arrow key is pressed, then the sprite touches a wall, it should change x by -3. Remember to keep that code in the ”if right arrow key pressed". This gives it smooth movement against walls and happens so fast nobody will notice it. I hope this helps (because I'm horrible at explaining things), and you can always reply if you still don't understand.
Another simple way you could do this is with something like this:
Hope this helps

Last edited by -XPT- (May 13, 2016 02:44:39)
- SuperWolf64
-
100+ posts
Collision detections; HOW??
Okay, I'll try this Okay, so I think I know what you are saying, but forgive me if this doesn't help you at all.
You probably have a code like “Forever: If right arrow pressed then move right, if left arrow pressed then move left, etc. Well, to make your character not pass through walls, you should add a piece of code after each ”move“ block: If touching wall then move negative the distance you moved first. For example, if you change x by three each time the right arrow key is pressed, then the sprite touches a wall, it should change x by -3. Remember to keep that code in the ”if right arrow key pressed". This gives it smooth movement against walls and happens so fast nobody will notice it. I hope this helps (because I'm horrible at explaining things), and you can always reply if you still don't understand.
Last edited by SuperWolf64 (May 14, 2016 19:46:32)
- SuperWolf64
-
100+ posts
Collision detections; HOW??
It works! It sticks a little sometimes, but rarely. ThanksOkay, I'll try this Okay, so I think I know what you are saying, but forgive me if this doesn't help you at all.
You probably have a code like “Forever: If right arrow pressed then move right, if left arrow pressed then move left, etc. Well, to make your character not pass through walls, you should add a piece of code after each ”move“ block: If touching wall then move negative the distance you moved first. For example, if you change x by three each time the right arrow key is pressed, then the sprite touches a wall, it should change x by -3. Remember to keep that code in the ”if right arrow key pressed". This gives it smooth movement against walls and happens so fast nobody will notice it. I hope this helps (because I'm horrible at explaining things), and you can always reply if you still don't understand.

- Discussion Forums
- » Help with Scripts
-
» Collision detections; HOW??