I hate that I'm so lousy at math and this is something i struggle with all the time. In my game i wanted to calculate how much the opacity for my bullet object has to decrease per tick, starting from 100% and going down to zero over a distance of 100 pixels.
Right now i know the following:
Bullet speed: 150 pixels/sec
Travel distance: 100 pixels
Current opacity: 100%
Delta time (dt)
As i understand it, i need to calculate the speed the bullet takes to travel over the set distance which should be time = distance/speed. So 100/150 = 0.66 pixels/sec right?
But this is only how far it moves each second, so to calculate the distance each tick (to get frame based animation) you probably have to do 0.66 * dt? This gives me approx 0.0106 pixels/tick...
This is where it gets confusing and I'm sure that i've approached the whole thing wrong up until now... but how do i know how much the opacity should decrease each tick? <img src="smileys/smiley5.gif" border="0" align="middle" />