Strict Graphics 640,480 AutoMidHandle True Global ObjectList:TList=CreateList() Const COLLISION_LAYER=1 Type img Field image:timage Field x:Float,y:Float Field sx:Float,sy:Float Field rot:Float,sr:Float Field Collided:Int=False Field CollisionList:String Field ID:Int Field R:Byte, G:Byte, B:Byte Function Create:img(Image:TImage,j:Int) Local i:img = New img i.image = Image i.x = Rnd(20,620) i.y = Rnd(20,460) i.sx = Rnd(-3,3) i.sy = Rnd(-3,3) i.rot = Rnd(0,360) i.sr = Rnd(-5,5) i.ID = j i.R =Rnd(0,255) i.G =Rnd(0,255) i.B =Rnd(0,255) ObjectList.Addlast i Return i End Function Method UpdateState() x :+ sx y :+ sy rot :+ sr If x>620 And sx>0 sx = -sx ElseIf x<20 And sx<0 sx = -sx EndIf If y>460 And sy>0 sy = -sy ElseIf y<20 And sy<0 sy = -sy EndIf SetBlend ALPHABLEND SetRotation rot CollideImage(image,x,y,0,0,COLLISION_LAYER,Self) CheckCollision() End Method Method DrawSelf() SetRotation rot SetColor R,G,B DrawImage Image,x,y SetColor 255,255,255 DrawText ID,x,y End Method Method CheckCollision() Local p:Object[]=CollideImage(Image,x,y,0,COLLISION_LAYER,0) If p.length>1 Then For Local k:img=EachIn p k.R :+ B k.G :+ R k.B :+ G Next EndIf EndMethod End Type SeedRnd MilliSecs() Local URL:String="http::www.2dgamecreators.com/tutorials/gameprogramming/basic/" Global Image:TImage=LoadImage(LoadBank(URL+"blobship_1-1.png")) For Local j = 0 To 20 img.create(Image,j) Next Repeat Cls For Local i:img = EachIn ObjectList i.UpdateState() Next For Local i:img = EachIn ObjectList i.DrawSelf() Next Flip ResetCollisions() For Local i:img = EachIn ObjectList i.Collided=False Next If KeyHit(KEY_A) Then Repeat Until KeyHit(KEY_S) EndIf Until KeyHit(KEY_ESCAPE)