How to implement the light trails for a tron game?
- by Link
Well I was creating a TRON style game, but had an issue with creating the actual light trails for the game. What I'm doing currently is I have an array the same size as my window in pixel size, implemented like this:
int* collision[800][600];
Then when the bike goes on a certain pixel, it is marked with a 1 for traveled on. However what is the most efficient way to create a working light trail display?
I tried to do something like this:
int i, j;
for(i=0; i<800; i++)
for(j=0; j<600; j++)
if(*collision[i][j] == 1)
Image::applySurface(i, j, trailSurface, gameScreen);
But it isn't working properly? It just fills the whole screen with a sprite instead.
Whats a better/faster/working way to do this?