PATH EDITOR

BlitzPlus Forums/BlitzPlus Programming/PATH EDITOR

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.

If Abs(cx-pathx(current_path+1))<1

Abs means make the number positive regardless.

cx is the current x coord of the rectangle.

pathx(0) is the array that holds the x locations of the path points.

current_path+1 is the current waypoint the rectangle is on. The plus one means the bit of code will compare the rectangles x coord with the x coords of the next waypoint.

So, let cx=100 and let current_path=5 and let pathx(5)=103

if Abs(cx-pathx(current_path))<1

if abs(cx-pathx(5))<1

if abs(100-103)<1

if abs(3)<1


If the distance is less than one pixel then, current_path is incremented.

And Abs(cy-pathy(current_path+1))<1


same as before, except compare the y coord of the rectangle with the y coord of the next path point.

If you need anymore help, plz post back :)