Hi
In our game - Maggie the Gardener - we store every plant in TList. When player press right mouse button to remove a plant very often soft removes plants that are far away from the mouse pointer. As we can not see bugs in our code we believe that there is something wrong with TLists mechanism. Here is the code example:
This piece of code should be enougth to say if we are wrong or not.
In our game - Maggie the Gardener - we store every plant in TList. When player press right mouse button to remove a plant very often soft removes plants that are far away from the mouse pointer. As we can not see bugs in our code we believe that there is something wrong with TLists mechanism. Here is the code example:
Method RemoveObjects(all=False) If(all) ClearList(objectsList) Return Else If(deleteTimer._ticks<4) Return For temp=EachIn objectsList If(temp.CollideWithCursor()) ListRemove(objectsList,temp) deleteTimer._ticks=0 soundEngine.PlaySfx("usowanie") Return EndIf Next EndIf End Method Method CollideWithCursor() ' If(MouseX()>x and MouseX()<x+ImageWidth(brush.bitmap)) If(MouseY()>y and MouseY()<y+ImageHeight(brush.bitmap)) ResetCollisions() CollideImage(brush.bitmap,x,y,0,0,1) If(CollideRect(MouseX(),MouseY(),1,1,1,0)) Return True EndIf EndIf Return False End Method
This piece of code should be enougth to say if we are wrong or not.