Pacman-esque game in c# raylib. Help with optimisation/collision
Im making a game for my class project and i've stumbled onto a problem with my level design. Essentially the way i made my level is by creating and generating rectangles from a list[,] array(? i think its called that) for every wall in the level. Only problem is that this method ends up generating like 100 rectangles and fries the computer. Additionally, i have not found a method to add collision between these rectangles and my character (also a rectangle).
i can provide a github repository if needed for the code.
7 Replies
Pacman takes place on a consistent grid, why not represent the walls as a single 2d array?
100 rectangles should absolutely not be an issue unless you're using an extremely inefficient representation
A rectangle at its simplest should literally be 4 integers
this is what i've done, is this a 2d array?
Are you reusing the same list between draws?
betwwen draws?
probably, theres only one list
Between calls to this method
its only called once
ah
Yeah then idk why this would be an issue