Particles are not moving correctly [closed]
- by cr33p
I want to make a particle explosion, after something gets destroyed, but somehow only one line of mixed colors show up on the screen.
Here's the header:
http://pastebin.com/JW5bPLj2
Here's the source:
http://pastebin.com/KHmFqytD
I don't get what's wrong, as it's nearly the same as in "Programming Linux Games"
Can somebody help me fix that?
PS: "Uint32 delta" is needed to update the pixels based on time.
PSS: Maybe I should add that it's programmed in C and includes SDL.
EDIT: Found the problem. It was the "drawParticles" function.
The problem was, that I passed a double to "offset" (as particles[i].x, etc are all doubles). So I ended up with values like ~MAX_INT because I didn't cast the doubles properly to ints.