I wonder if someone would be so kind as to tell me what code to add to this small program, so I can delete the rectangle I hit with my Right_Mouse_Button.
Excuse my ugly coding, but I'm trying to understand Bmax.
SetGraphicsDriver GLMax2DDriver() Global number_of_Drects = 10 Type rect Field x#,y#,size# Field rojo#,verde#,azul# 'Global rectnumber=0 Global dadas:TList Method draw() SetColor(rojo,verde,azul) DrawRect x,y,size,size End Method Method move() x=x+(size/8) If x > 800 x=0 EndIf End Method Method Compare(other:Object) If rect(other).size < size Return -1 Return 1 End Method Function create(cm) If dadas = Null dadas = CreateList() socas:rect = New rect If cm=1 socas.x = MouseX() ; socas.y = MouseY() Else socas.x = Rand(5,795) ; socas.y = Rand(5,595) EndIf socas.size = Rand(4,20) socas.rojo = Rand(80,255) ; socas.verde = Rand(80,255) ; socas.azul = Rand(80,255) dadas.addlast(socas) End Function End Type For n = 1 To number_of_Drects rect.create(0) Next SortList(rect.dadas,False) 'ClearList(rect.dadas) a=CountList(rect.dadas) Graphics 800,600 Repeat Cls For t:rect = EachIn rect.dadas t.draw t.move Next DrawText a,20,80 Flip If MouseHit(1) rect.create(1) SortList(rect.dadas,False) a=CountList(rect.dadas) EndIf If KeyHit(key_space) ClearList(rect.dadas) a=CountList(rect.dadas) EndIf Until KeyHit(key_escape) Or AppTerminate()
Excuse my ugly coding, but I'm trying to understand Bmax.