How to implement the light trails for a tron game?

Posted by Link on Game Development See other posts from Game Development or by Link
Published on 2012-09-14T02:16:22Z Indexed on 2012/09/14 15:50 UTC
Read the original article Hit count: 254

Filed under:
|

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?

© Game Development or respective owner

Related posts about game-mechanics

Related posts about sdl