How to use vector in VB.net?


  • Hi,

         Hello to all programmer. I would like to ask about vector in VB.net. Currently, I'm working on a game which need the mouse to snatch food from my player. Basically, the mouse need to go to the nearest food and eat it. It's something like AI also as the mouse has to predict which food is the closest to it and go the food to eat it.

         Hence, how can I make this possbile? I know there are different ways but how should I go about doing it? :)



    Monday, February 06, 2006 1:25 AM

All replies

  • VB.NET does not have any built in support for this sort of thing ( neither do C# or C++ ).  All three have good maths libraries, and so you need to pick an algorithm, and impliment it yourself.  The obvious way is to keep the locations of everything, then work out which items are closest by working out what is within a square ( which means it's easy to test ) and if in doubt, use trig to work out the vectors and compare them.

    You say you know there are different ways - I guess choose one of them and then write it in VB.  There's nothing in there you can just call, AFAIK.


    Monday, February 06, 2006 1:29 AM