I have my invaders being drawn on screen in relation to a pattern i set in a data statement. The thing is I cant seem to get them to collide with bullets. I thought this would be simple but its buggin me.
heres da codezz for da loop dat deals wid it.
Thx for any help :)
Function read_zoiks_pattern()
Restore level1
For y = 0 To 13
Read level$
If level$ = "0" Then Exit
For x = 0 To 11
pos(x,y) = Mid$(level,x+1,1)
Next
Next
End Function
Function update_zoiks()
For y = 0 To 2
For x = 0 To 7
If pos(x,y) = "-"
z.zoik = New zoik
z\zx# = mapx#+(x*65)
z\zy# = mapy#+(y*45)
DrawImage zoikoidgreen,z\zx,z\zy,zoikoidgreen_frame
EndIf
Next
Next
If change_direction = 1 Then
mapx# = mapx# + zoik_speed
For y = 0 To 2
For x = 0 To 7
If mapx#+(x*65) >= 580 Then change_direction = 0
Next
Next
EndIf
If change_direction = 0 Then
mapx# = mapx# - zoik_speed
For y = 0 To 2
For x = 0 To 7
If mapx#+(x*65) < 0 Then change_direction = 1
Next
Next
EndIf
If MilliSecs() > zoikoidframe + 100 Then
zoikoidframe = MilliSecs()
zoikoidgreen_frame = zoikoidgreen_frame + 1
If zoikoidgreen_frame >=3 Then zoikoidgreen_frame = 0
EndIf
End Function
Function update_rebellion()
DrawImage rebellion,rebelx,rebely
If KeyDown(203) = True
rebelx = rebelx - rebelspeed
ElseIf KeyDown(205) = True
rebelx = rebelx + rebelspeed
EndIf
If KeyHit(29) = True
If MilliSecs() >= btimerreb + 500 Then
btimerrb = MilliSecs()
b.bulletr = New bulletr
b\bx = rebelx
b\by = rebely
EndIf
EndIf
For b.bulletr = Each bulletr
DrawImage bulletr,b\bx,b\by
b\by = b\by - 4
If b\by <0 Then Delete b
Next
If rebelx >= 590 Then rebelx = 590
If rebelx <= 0 Then rebelx = 0
End Function
Function collision()
For b.bulletr = Each bulletr
For z.zoik = Each zoik
;If ImagesCollide(bulletr,b\bx,b\by,0,zoikoidgreen,mapx#+(x*65),mapy#+(y*45),zoikoidgreen_frame)
If ImagesCollide(bulletr,b\bx,b\by,0,zoikoidgreen,z\zx*65,z\zy*45,zoikoidgreen_frame)
Delete z
Delete b
EndIf
Next
Next
End Function
.level1
Data "--------"
Data " ------ "
Data "-- --"
Data "0"
|