Aug-10-2019, 07:43 PM
Hi, I'm trying to replicate pacman with pygame. I want to make the player move wherever he wants but on one condition: if he's too near the wall I have to avoid some keys pressed and allow him to go only in certain directions, where there aren't any walls but I encountered a problem with wall collision. I used spritecollide() function but it doesn't really work for my case. I tried to iterate through the entire list of walls, while I was comparing pacman rect coordinates but it produced some strange behaviours. So I came up with an idea, keep track of every coordinates I'm interested in but probably isn't a good solution because I should hardcode them so I'm wondering if you have some ideas or prompts of wall collision in pacman's style. Here is my entire code: https://github.com/rustyjoee/pacman