Strict SetMaskColor 0,0,0 Global Number_of_ships = 10 Global My_Image:Timage=LoadImage( "ship.bmp" ) MidHandleImage( My_image ) Type ship Field X#, Y# Field Dir Field Armor = 100 Field Speed# = 0.2 Field red Field green Field blue Method draw() SetColor (Self.red,self.green,self.blue) SetRotation (Self.dir+90) DrawImage( my_image,self.X#, self.Y#) End Method Method update() self.X:+ self.Speed*Cos( self.Dir ) self.Y:+ self.Speed*Sin( self.Dir ) For Local theship:ship = EachIn collisionList If ImagesCollide2(my_image,self.x,self.y,1,self.dir+90,1,1,my_image,theship.x,theship.y,1,theship.dir+90,1,1) RuntimeError "collided" Self.red=255 self.green=0 self.blue=0 EndIf Next End Method End Type Graphics 800,600,0 Global shipList:TList = CreateList() Global collisionlist:tlist=CreateList() For Local N = 1 To Number_of_ships Local theship:ship theship = New ship theship.Armor = Rand( 5 )*10 + 150 theship.X = Rand( 5, 800 ) ; theship.Y = Rand( 5, 600 ) theship.Dir = Rand( 0, 360 ) theship.green=255 theship.red=255 theship.blue=255 ListAddLast( shipList, theship ) Next While Not KeyDown(Key_Escape) For Local theship:ship = EachIn shipList theship.draw() theship.update() Next SetRotation 0 DrawText "Number of ships : "+shipList.Count(), 20, 20 DrawText "Press ESC to exit", 20, 40 Flip ;Cls Wend
cant get imagescollide2 to return positive
can anyone help?
also how would I delete the type instances of the ships that collide?