So i’ve almost completed my game. It is a 2D gamje where the character moves across this world trying to avoid the enemies. When I go up, the character never stops. Is there a way to create a simple world border around my world? Meaning, that the character stops at some point and doesn’t continue to leave the map.
if your world is effectively a square then line up, at each side, an empty gameobject with a box collider. if your player has a rigidbody or collider attached to it also, when you reach these box colliders at the edge of your world, they should stop you moving past the world edge.
For surety, align each GameObject with it
s repsective BoxCollider (stretched out to cover the length of your worlds sides)
and bring them into your world edge a little to ensure the collision happens before you actually fall of the world.
Overall, to give you a more succinct answer we would need to know how your player is being handled (Rigidbody or simple input triggered translation and rotation)
You may find these links below helpful aswell.
Unity Student (in JS im afraid but that should be too scary)
And of course, the best place to start…
Unity Script ref: Collisions
Take care and Thanks for reading.