I know, collision detection is covered a lot all over this site and many others. I don't fully understand it though. I need some help understanding some of the ways I can use classes and collision to get what I want for my program.
I'm working on an RPG game with Pygame. I want my player to stay in the center of the screen and have the map move around the player as opposed to the player moving around a map. So far I have a character that stays in the middle of the screen but has a great animation that runs perfectly with a background image that moves around according to the direction and speed of the player. The only thing that really moves is the background image.
What I want to add at this point is a complicated maze of collision boxes to match the background image. I want the collision boxes to move with the background image. I need a single collision box for the player that sits in the middle of the screen and I need a maze of collision boxes that move around and collide with the player.
I want to know what the best and most compact way of doing this would be. I had an idea, but I don't quite know how I would put it in action. I'm wondering if I could draw out a maze like this:
Map = [
"WWWWWWWWWW",
"W W",
"W W",
"W W",
"W W",
"W W",
"WWWWWWWWWW"
]
Would there be a way to create a collision box for each of the "W"'s in the "Map"? I've seen it done before, but I don't fully understand it, and I would love to get some more insight as to how I would use it for my program.
Just a small detail for my program is that the player and each block or space is 50 x 50 pixels. I thought I'd mention that in case it helps you help me.