Rectangle Collision Detection in Monogame
Hello, I am working on a game for my A level Computer Science course in Monogame. I am trying to work on rectangle collisions (I previously tried per-pixel but ultimately decided it wasn't worth the trouble). I need something to happen when two rectangles (one always being the player) collide, and given the types that collide, something different will happen. For enemies, there will be a check to see if the player is attacking, if they are, the enemy will die, and if not, the player will take damage. I need a collection system so when the player comes in contact with a ring, they collect it and the ring disappears. Finally, I need movement style collision, where the player interacts with a spring, they get sent in the direction it's facing by a set amount. I have attached a screenshot of the logic for my collision, I just don't know how I would go about implimenting it. Thank you in advance. (please note not every boolean is displayed, but each one is coded the exact same way. this screenshot is from the player class, also).
2 Replies