My short game is almost finished! I have a question, though. If I want to be able to give an item to another actor, but only when I'm within a certain distance of him, how do I do it? This other actor can move, so that complicates things a little. I'm sure there's an easy way to do it. Can anyone help?
Here you go Jim try something like this:|
(if(< (send gEgo:distanceTo(hMan)) 30)
Print("Here ya go buddy!"))
(else Print("Stand closer to the hungry man!"))
(else Print("You don't have a fish to give!"))
The other actor moving is irrelevant, on line 3 it checks to see the distance to hMan if it is less than 30 you're close enough, otherwise you're told to stand closer
|Jim C||Ah, great! Thanks so much! That's exactly what I needed.|