instance of type entity UFO\Model
Blitz3D Forums/Blitz3D Beginners Area/instance of type entity UFO\Model
| ||
I am working on the astroids game that came with blitz. I have added a HUD that will be used for locking on targets. Right now I just want to draw a triangle around each UFO instance. To do this I used entityinview. The problem is that it will only show the origanal ufo mesh but none of the instances. I tried... CameraProject(camera,EntityX(UFO\Model),EntityY(UFO\Model),EntityZ(UFO\Mode wich just gives an eror variable must be a type. So I guess one way to do this would be to loop through each ufo\model using a for each next loop. So am I on the right track even or is there a better way to do this? P.S How do you post code on this site so its in that black and green scroll box? Type UFOInfo Field x,y,z ;position in 3d world Field Model ;UFO Model End Type ;This part is in the show stats function CameraProject(camera,EntityX(UFO\Model),EntityY(UFO\Model),EntityZ(UFO\Model)) If EntityInView (UFO\Model,camera) = True Then Text ProjectedX#()+10,ProjectedY#()+20,"UFOMESH" Text 240,460,"entity in view" Color 100,0,25 Line ProjectedX#(),ProjectedY#(),320,240 ;triangle lock Color 25,255,25 Line ProjectedX#()+10,ProjectedY#()+10,ProjectedX#(),ProjectedY#()-10 Color 25,255,25 Line ProjectedX#()-10,ProjectedY#()+10,ProjectedX#(),ProjectedY#()-10 Color 25,255,25 Line ProjectedX#()+10,ProjectedY#()+10,ProjectedX#()-10,ProjectedY#()+10 EndIf;MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmm Line 310,240,315,240 Line 325,240,330,240 Line 320,230,320,235 Line 320,245,320,250 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx Function PlaceUFO() UFO.UFOInfo = New UFOInfo UFO\x=Rnd(-10000,10000) UFO\y=Rnd(-10000,10000) UFO\z=-10000 UFO\Model=CopyEntity(UFOMesh,0) EntityType UFO\Model,6 ;Set UFO Type to 6 EntityRadius UFO\Model,150 PositionEntity UFO\Model,UFO\x,UFO\y,UFO\z UFOCount=UFOCount+1 End Function ;Thanks for any help ;Blitz Rocks |
| ||
Haven't looked at the program in the samples but as you have more than one type instance you will need to iterate through them with a for UFO.UFOinfo = each UFOinfo in your stats function as you suggest. The way you have it you're only trying to look at one instance of the type and if the var UFO is not defined as global it's likely the reason your getting this error. To put the code in a box etc.. use : {code} Insert Code here {/code} But replace the {} brackets with [] |