Player Collisions


During our last sprint one of my task was to make it so that the player could not reach where the enemies were being spawned. Since we are building  a tower defense game, one of our core mechanics is for the player to place different traps in the level to help them defend an objective. We found out though that the player could just go to where the enemies were spawning, place a bunch of traps and kill them before they had a chance to do anything. So to solve this we need a way to block off the player  without also blocking off the enemies. I decided to create an object channel for the player so that we could use a collision box that would block the player and let the enemy pawns through. After implementing and testing it worked but I soon found out that it also made it so that all collision boxes in the game block the player.


This caused problems with our traps because the way that they were being triggered were also through collision boxes, meaning that every trap you put down was an invisible obstacle to the player. After looking into the collision responses for the different objects I noticed that by default a collision box had an object type of world dynamic. Since this invisible wall would be stationary I figured switching it over to world static would allow the player to be blocked by it while also allowing the other existing collision boxes to keep the current presets. This way we don't have to go through all our traps and objects and make sure they don't collide with the player.


Get Dimension Defender

Leave a comment

Log in with itch.io to leave a comment.