Delete Light
BlitzMax Forums/MiniB3D Module/Delete Light
| ||
Hey there, I have a problem with my unload-procedure when I try to unload the lights that I've created during the game by using the createlight command. I somehow can't delete the lights by using the following commands: freeentity delete (doesn't work at all in minib3d) freelight (doesn't seem to exist in minib3d) anybody experiencing the same problem? this is the code: Type Light Field msh:TLight Field i:Int Function Neu:Light() Return New Light End Function End Type Function AddLight(x:Int,y:Int,z:Int) Local NewLight:Light = New Light ListAddLast Lights, NewLight NewLight.i = CountList(Lights) NewLight.msh = CreateLight(2) positionentity Newlight.msh,x,y,z lightrange NewLight.msh,300 End Function Function UnloadAllLights() For Local rlight:light = EachIn lights If rlight.msh <> Null Then freeentity rlight.msh If rlight.msh <> Null Then rlight.msh = Null 'If rlight.msh <> Null Then Delete rlight.msh If rlight <> Null Then rlight = Null ListRemove(lights,rlight) Next End Function any help appreciated. roman Last edited 2011 Last edited 2011 |
| ||
FreeEntity <light> works here. Here's a small sample: Press space, and the colored light goes away, and the cube gets grey again. Also, saw one problem in your code: If rlight <> Null Then rlight = Null ListRemove(lights,rlight) You set rlight to null, then you try to remove it from your list. Should be the other way around - otherwise you're trying to remove NULL from the list! Last edited 2011 |
| ||
Thank you Slotman |