Setalpha by distance traveled

BlitzMax Forums/BlitzMax Programming/Setalpha by distance traveled

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

first you need to work out the distance:

Function distance#(x1, y1, x2, y2)
Local x=Abs(x1-x2)
Local y=Abs(y1-y2)
Return x+y
End Function

then, calcuate a number from zero to one based on distance

particle_alpha#=distance()/maxdistance#

make sure all numbers are floats involved in the calculation