Ok I see what you are saying in a way but my code is already posted. I just want the alien to be deleted as soon as the laser hit the alien but it just goes through it. How can I accomplish this task
Graphics 640,480
SetBuffer BackBuffer()
AutoMidHandle True
;TYPES
Type ship
Field x,y
End Type
Global s.ship=New ship
s\x=320
s\y=440
Type laser
Field x,y
End Type
Type alien
Field x,y,frame,shoot
End Type
Global a.alien=New alien
a\x=30
a\y=30
a\frame=0
a\shoot=shoot
Global ship=LoadImage("graphics/ship.bmp")
Global laser=LoadImage("graphics/laser.bmp")
MaskImage laser,0,0,0
Global alien=LoadAnimImage("graphics/alien.bmp",68,38,0,10)
MaskImage alien,0,0,0
Global background=LoadImage("graphics/stars.bmp")
Global a_bullet=LoadAnimImage("graphics/s_bullet.bmp",34,19,0,10)
While Not KeyHit(1)
Cls
t=t
If a\x>=620 Then t=1
Select t
Case 1
a\x=a\x-1
Case 2
a\x=a\x+1
End Select
If a\x<=30 Then t=2
UpdateAlien()
UpdateShip()
LaserUpdate()
TileImage background,x,y
Flip
Wend
End
;-----------------------
; Update Ship -
;-----------------------
Function UpdateShip()
If KeyDown(203) Then s\x=s\x-2 ;move ship left
If s\x<=10 Then s\x=10 ;stop ship from going off screen
If KeyDown(205) Then s\x=s\x+2 ;move ship right
If s\x>=610 Then s\x=610;stop ship from going off screen
If KeyHit(57) Then ;if space is pushed then shoot laser
l.laser=New laser
l\x=s\x
l\y=s\y+2
EndIf
DrawImage ship,s\x,s\y
End Function
;---------------
; Laser Update-
;---------------
Function LaserUpdate()
For l.laser=Each laser
l\y=l\y-5
If l\y<0 Then ;if laser goes off screen delete it
Delete l
Else
DrawImage laser,l\x,l\y
EndIf
Next
End Function
;-----------------
; Alien Update -
;-----------------
Function UpdateAlien()
a\frame=a\frame+1
Delay 4
If a\frame>9 Then a\frame=0
If a\frame<0 Then a\frame=9
DrawImage alien,a\x,a\y,a\frame
End Function
;--------------------
; Collision Update -
;--------------------
Function Update_Collision()
For l.laser=Each laser
For a.alien=Each alien
If ImagesCollide(laser,l\x,l\y,0,alien,a\x,a\y,0)
Delete a
EndIf
Next
Next
End Function