Currently, each level has 3 layers :
- background
- collisions(walls, invisible walls, ground, etc)
- foreground
My character sprite has 1 pixel to detect the collision. In this character class, there is a Color[] contains every pixels of the collision layer.
I calculate the position of the Character's pixel detection, and obtain an int that i can use with the Color[]
("CharactersPixel")
if ( Color[CharactersPixel].A != 0 )
Then collision.
It works perfectly.
But the collision layer has to be used by every others objects like particles, monsters etc.
The collision layer has about 3.800.000 pixels. so the Color[]
has the same.
If I add this Color[]
to every objects, this will use too much RAM, right ?