Computer Science Canada

generating random pills

Author:  helpmesodesperate [ Tue Feb 21, 2006 7:29 am ]
Post subject:  generating random pills

ok, how do u phrase an if statement that checks if the center x,y of pacman is within a certain range of the pill. I tried making it that the x,y of pacman has to be directly over the pill, but that doesn't seem to work.

Author:  Cervantes [ Tue Feb 21, 2006 8:07 am ]
Post subject: 

You can use the Math.Distance function to check the distance between two points.

If you don't have v4.0.5, you can make your own:
code:

fcn MathDistance (x1, y1, x2, y2 : real) : real
    result sqrt ((x2 - x1)**2 + (y2 - y1)**2))
end MathDistance


: