How could i do this?
Blitz3D Forums/Blitz3D Programming/How could i do this?
| ||
I would like to have my AI cars able to overtake other cars. I have them all stored in a type call "opp" (for opponent) But if i type: for o.opp = each opp if entitydistance(o\entity,?)<5 then moveentity o\entity,-o\speed,0,0 next Obviously, the reason i've typed the "?" above, shows that i didn't have a clue how to access a check on all other cars within that type :( I would be delighted if someone could help me out here :) Thanks |
| ||
Umm, maybefor o2.opp = each opp for o.opp = each opp if entitydistance(o\entity,o2\entity)<5 moveentity o\entity,-o\speed,0,0 endif next next But I haven't tried that, just looking at it. |
| ||
hmmm, i'll give that a try :) Cheers man!! |
| ||
You PCD GUY....are a STAR!!!!! :D It works!!!! Thankyou so very very much Thanks again :D |
| ||
It's more tidy to dump that check in a seperate function, too.for o.opp = each opp myFunction(o.opp) next function myFunction(o.opp) for o2.opp = each opp If entitydistance(o2\entity,o\entity)<5 moveentity o2\entity,-o2\speed,0,0 endif next end function Depends on your tastes, though. |
| ||
Hmmm, any advice is greatly appriciated :D I shall give that one a whirl Thanks Mr Picklesworth :) |
| ||
Ensure that o <> o2. |