Skip to main content
GameDev.net gamedev.net
🔒 Locked

Motion trails

Started by Pierspo Oct 22, 2000 at 4:15 PM 0 replies 600+ views
Original Post
Pierspo
Pierspo
I''m new to graphics programming and programming in general this will probably seem like a very simple question here goes.(I use djgpp and allegro) ive got a pixel bouncing up and down my screen 8bit color 320 by 200 and I want it to leave a trail that fades behind it. At first I thought i could use makecol() to make the color of the pixel and then leave a trail using decreasing values of RGB but makecol() doesnt seem to work as i had anticipated. I have also thought about applying a kind of filter to the bitmap every frame before plotting the pixel but i havnt a clue where to start. Any help much appreciated.
yeah boy
Llamasoft.net
Llamasoft.net
hmm, something like:

        

#define NUM_PARTICLES 10

#define NUM_TRAILS 5

struct TRAIL
{
int x;
int y;
int colour;
};


struct particle
{
TRAIL trail[NUM_TRAILS];
int x;
int y;
int colour;
int ctrail;
}p[NUM_PARTICLES];



would work... and is simple like you want (not hugely efficient though)... just move / draw the particle and then draw the current trail (ctrail) at the last x, y of the particle... next loop, increment the ctrail and draw it at the last x, y, etc... until you reach NUM_TRAILS-1... then go back to 0

Colour fade out, however, is another matter altogether, and much harder... you can't just cycle back through the colours to 0... you could make a CLUT containing the hues of the colours from 255 - 0, and cycle through them, i suppose...

good luck!

Nick - Head Designer, Llamasoft.net

--
Visit our website...

Llamasoft.net
Games, goodies and ingenuity

Edited by - Llamasoft.net on October 22, 2000 5:21:44 PM
Nick - Head Designer, Llamasoft.net--Visit our website...Llamasoft.netGames, go

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.