Simple Types Problem
BlitzMax Forums/BlitzMax Beginners Area/Simple Types Problem
| ||
I have a probably rather simple problem with types. But as I'm still getting my head around them I'm stumped. I have an UFO which can fire a bullet, now the bullet needs the UFOs ID so that the UFO doesn't destroy itself when flying into its own bullets. Destroying other UFO's is fine. Basically in pseudocode: |
| ||
I would set a field in the shot type from which ufo it was shooted.Type TUfo Method Shoot local shot:TShot=createshot(self) end Method Method Collide() if shot.ufo=self then print "I am hit by my own bullet" if shot.ufo<>self then print "I am hit by an enemies bullet" End Method end Type Type TShot Field ufo:TUfo Method CreateShot:TShot(ufo:Tufo) self.ufo=ufo return self end Method end Type |
| ||
Wonderful! Thanks!! |
| ||
A bullets a bullet. I think the UFO should be able to shoot itself. :) |