Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 generating random pills
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
helpmesodesperate




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Feb 21, 2006 8:07 am   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: