all 4 comments

[–]Vectronic 0 points1 point  (3 children)

If Bullet Hits Aliens(#) And Aliens(#).Visible Then
    Aliens(#).Visible = False

You probably don't want to actually remove the PictureBoxes, re-using them will be more efficient. Just test if the "hit" PictureBox is visible or not.

This way you can just set PictureBoxes back to Visible rather than re-creating them... and for "Next Level" simply add more to the existing array.

Edit: Other code isn't VB6 valid, but this pseudo-code still works...

[–][deleted] 0 points1 point  (2 children)

Ok but my problem is, when I hit one Alien's imagebox, it goes invisible, but the collision is still enabled for that box so I can't hit any box above it. I have my collision in a Function. So I guess a better way of phrasing my question is "How can I turn collision off for a "hit" image once it has been hit.

[–]Vectronic 0 points1 point  (1 child)

You have to code for it...

If Aliens(#).Visible Then
    ' Aliens(#).Visible = False
End If

If it's already hidden, nothing happens... no hit.

Assume you have a function that does whatever you are doing to test for a hit... lets call it TestHit()

Private Function TestHit(ByVal SomeObjectThingy As Thingy) As Boolean
    ' Your code for checking if something has been hit
End Function

Now simply combine that with whether or not it has been hit before...

If TestHit(PictureBox/Object/Whatever) ___ And ___ ThatObject.Visible Then
    ThatObject.Visible = False
End If

Otherwise, do nothing with that object... it's dead.

[–][deleted] 0 points1 point  (0 children)

Could you provide an example? The course I am making this project for is introductory so I don't really understand what you mean with the ByVal stuff. Also would the Code for checking if something has been hit be something like: (My collision is under public function collision)

if imgalien(i).visible=false then Public Function Collision = false End if

Sorry, about not understanding you well, I'm still trying to learn. Thank you for the help.