Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make collision?
- percydal
-
New Scratcher
8 posts
How to make collision?
My game is like the pokemon games. Top of character view, but i want trees/houses to stop the character from walking on them.
- MookyE
-
Scratcher
100+ posts
How to make collision?
One easy way to do it for your game: make variables for your last position, and if the player is not touching a ground colour, use the variables to go to the last position. Or just go to last position if touching house.
One method looks better on front of house, one on side. You should also make movement faster
One method looks better on front of house, one on side. You should also make movement faster
- percydal
-
New Scratcher
8 posts
How to make collision?
One easy way to do it for your game: make variables for your last position, and if the player is not touching a ground colour, use the variables to go to the last position. Or just go to last position if touching house.
One method looks better on front of house, one on side. You should also make movement faster
Thanks alot, i’m sure i will figure it out with this tip! PS: I’ll implement runnig as soon as possible!
- percydal
-
New Scratcher
8 posts
How to make collision?
One easy way to do it for your game: make variables for your last position, and if the player is not touching a ground colour, use the variables to go to the last position. Or just go to last position if touching house.
One method looks better on front of house, one on side. You should also make movement faster
Do you have a script for that i made the variables but i don’t know what to do
- Infinus-Coder
-
Scratcher
8 posts
How to make collision?
https://scratch.mit.edu/projects/606706774/ you see the parts in this project and can add it in urs.
- bSpyder
-
Scratcher
100+ posts
How to make collision?
One easy way to do it for your game: make variables for your last position, and if the player is not touching a ground colour, use the variables to go to the last position. Or just go to last position if touching house.
One method looks better on front of house, one on side. You should also make movement faster
Theres a more simple way to do that
In your movement script just check if you're touching a wall/platformer/whatever
If you are touching just move backwards using the minus block
Example:
define Move (steps)
move (steps) steps
if <touching [whatever v] ?> then
move ((0) - (steps)) steps //turn it into negative steps
end
For example you move 10 steps forward, you touch a wall then move 0 minus 10 steps backwards- which is -10
- MookyE
-
Scratcher
100+ posts
How to make collision?
One easy way to do it for your game: make variables for your last position, and if the player is not touching a ground colour, use the variables to go to the last position. Or just go to last position if touching house.
One method looks better on front of house, one on side. You should also make movement faster
Do you have a script for that i made the variables but i don’t know what to do
Just set the x to the last x variable and y to the last y variable
I think its also better to just set the variables to x and y instead of changing them by an amount
- percydal
-
New Scratcher
8 posts
How to make collision?
Thanks for all the tips. I'm new and didn't know how to see if anyone commented but with all you tips i think my 2 braincells will figure it out!
- dagora
-
Scratcher
1 post
How to make collision?
One easy way to do it for your game: make variables for your last position, and if the player is not touching a ground colour, use the variables to go to the last position. Or just go to last position if touching house.
One method looks better on front of house, one on side. You should also make movement faster
Theres a more simple way to do that
In your movement script just check if you're touching a wall/platformer/whatever
If you are touching just move backwards using the minus block
Example:define Move (steps)
move (steps) steps
if <touching [whatever v] ?> then
move ((0) - (steps)) steps //turn it into negative steps
end
For example you move 10 steps forward, you touch a wall then move 0 minus 10 steps backwards- which is -10
briliant
- percydal
-
New Scratcher
8 posts
How to make collision?
One easy way to do it for your game: make variables for your last position, and if the player is not touching a ground colour, use the variables to go to the last position. Or just go to last position if touching house.
One method looks better on front of house, one on side. You should also make movement faster
Theres a more simple way to do that
In your movement script just check if you're touching a wall/platformer/whatever
If you are touching just move backwards using the minus block
Example:define Move (steps)
move (steps) steps
if <touching [whatever v] ?> then
move ((0) - (steps)) steps //turn it into negative steps
end
For example you move 10 steps forward, you touch a wall then move 0 minus 10 steps backwards- which is -10
briliant
Yeah i used this one for the game! It works like a charm!
- jas1000
-
Scratcher
100+ posts
How to make collision?
Thanks for all the tips. I'm new and didn't know how to see if anyone commented but with all you tips i think my 2 braincells will figure it out!1. You can do it! 2. You have more brain cells!
- SkinBorrower
-
Scratcher
4 posts
How to make collision?
Where and how do you implement this into the script?
- Discussion Forums
- » Help with Scripts
-
» How to make collision?






