Results 1 to 35 of 35

Thread: Creating a loop for bitmap movements

  1. #1

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Question Creating a loop for bitmap movements

    Hi,

    I would like to loop my bitmap that I have hitting another bitmap.

    Code:
    If (ship2.Top + ship2.Height >= PictureBox3.Top) And (ship2.Top <= PictureBox3.Top + PictureBox3.Height) And (ship2.Left <= PictureBox3.Left + PictureBox3.Width) Then
                ship2.Visible = False
                Timer1.Enabled = True
    Thank you.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    It looks like you're using pictureboxes, use the IntersectsWith method to determine if a collision occurred. The best rectangle to use would be the Bounds property.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    My code already makes collision of two bitmaps, one in motion and the other stationary.

    I need example code of how to loop it so that it repeats the same process all over again.


    Private Sub InstanceRectangleIntersection( _
    ByVal e As PaintEventArgs)

    Dim rectangle1 As New Rectangle(50, 50, 200, 100)
    Dim rectangle2 As New Rectangle(70, 20, 100, 200)

    e.Graphics.DrawRectangle(Pens.Black, rectangle1)
    e.Graphics.DrawRectangle(Pens.Red, rectangle2)

    If (rectangle1.IntersectsWith(rectangle2)) Then
    rectangle1.Intersect(rectangle2)
    If Not (rectangle1.IsEmpty) Then
    e.Graphics.FillRectangle(Brushes.Green, rectangle1)
    End If
    End If
    End Sub
    How does this above actually help me with the bitmaps?

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    So you want to loop the process of moving and colliding the bitmaps? Try something like this:

    Pseudo Code:
    1. 'Loop 10 times
    2. For i As Integer = 0 to 9
    3.    Do Until rect1.IntersectsWith(rect2)
    4.       'Move
    5.    Loop
    6. Next

    Basically what I use there is a nested loop.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  5. #5

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by dday9 View Post
    So you want to loop the process of moving and colliding the bitmaps? Try something like this:

    Pseudo Code:
    1. 'Loop 10 times
    2. For i As Integer = 0 to 9
    3.    Do Until rect1.IntersectsWith(rect2)
    4.       'Move
    5.    Loop
    6. Next

    Basically what I use there is a nested loop.
    Well ship2 collides with picturebox3, once done it is removed from the screen. So I need the whole process to start again. I'm doing this for two bitmaps that collide with picturebox3. I still haven't gotten around to having two images load exactly where the ship1, 2 are removed as debris.

    Lastly, I'm puzzled as to where to put the loop, in my private sub checkhit() or the actual Timer1?

    'IntersectsWith' is not a member of 'System.Windows.Forms.PictureBox'.

    ^This is what loads eitherway.

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Creating a loop for bitmap movements

    IntersectsWith is a member of a rectangle. The PictureBox has a couple properties that expose rectangles, though I can't quite remember the names at the moment. Bounds might be one of them. The idea is to get the area of the PictureBox as a rectangle so that you can use the methods for checking the interaction of two rectangles. Take a look at the properties of the PictureBox to see which return type Rectangle, then you can compare them to see which seems most suitable (I think there are two).

    That loop will run until the intersection happens, and it will prevent any user interaction while it occurs. As such, it's an example, but quite likely not what you want to have happen. If you have a timer ticking away, and the pictureboxes move each time the timer ticks, then the timer is in lieu of the loop, so the actual loop wouldn't exist anywhere.

    Other than that, I can't understand what process you want to have start again, so I'm not sure what it is you want to be looping.
    My usual boring signature: Nothing

  7. #7

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Well once the two bitmaps hit the other bitmap which is picturebox3, they both are removed, while two new bitmaps take the location of the former images, and then the whole process begins again. Essentially a loop.

  8. #8
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: Creating a loop for bitmap movements

    There are a lot of details about your project we do not know and that may affect the algorithms designed to make it work. So, I suggest you describe (briefly please) what it is that your program does or you want it to do. Of course, it is about two or three ships collinding, but, are they moving randomly? do then start always at the same place? do they colide with the picturebox at the same time? are you keeping score? does the user have any input? and so on.
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

  9. #9
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by pocket View Post
    Well once the two bitmaps hit the other bitmap which is picturebox3, they both are removed, while two new bitmaps take the location of the former images, and then the whole process begins again. Essentially a loop.
    I'd point you back to post #4.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  10. #10

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    No ship 1, and 2 move towards picturebox3 as a timer. There is no random movement. How ever for the computer controlled ship, I'll want to try and get something like that going for the missiles.

    But just for now, its as I've explained. The form loads, the hypothetical loop occurs, and begins again once an event takes place, such as collision with picturebox3. Thats it.

  11. #11

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by dday9 View Post
    I'd point you back to post #4.
    But it states an error, does the loop code line go in private sub or the timer1? Eitherway it doesn't change. I did edit the names, obviously. 'ship2.IntersectsWith(PictureBox3)'

    That is correct, if not, what am I doing wrong here?

  12. #12
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Right now you're checking if ship2 intersects with the picturebox, when you need to check if it intersects with the picturebox's bounds. This would be a corrected version:
    Code:
    ship2.IntersectsWith(PictureBox3.Bounds)
    Of course you can use any other property that returns a rectangle, it's just that the bounds property works best(I've found).
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  13. #13

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    It still displays an error that the intersectsWith is not a member of the system windows forms picturebox.

    Regardless of where I place the Loop code.

  14. #14
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Creating a loop for bitmap movements

    If Ship2 is a picturebox, then the code should be:

    Ship2.Bounds.IntersectsWith(PictureBox3.Bounds)

    As I mentioned earlier, .IntersectsWith is a member of Rectangle, not Picturebox, but Pictureboxes have properties that return rectangles.
    My usual boring signature: Nothing

  15. #15
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Ah, I'm sorry I thought that ship2 was a rectangle. In that case you'd do the same thing to ship2:

    Code:
    ship2.Bounds.IntersectsWith(PictureBox3.Bounds)
    Edit - Shaggy is a bit quicker on the trigger today.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  16. #16

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Right I pasted this, the error is gone. How ever none of my bitmaps are moving. Whether I place it in either Timer1 or the private sub checkhit() And in form, the program doesn't even load.

  17. #17
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Creating a loop for bitmap movements

    Depending on what you pasted, you won't see the bitmaps move with this code anyways. Running a loop like that will block the UI thread from pumping messages. Therefore, it will prevent any invalidation messages from getting through, so the screen will never be painted. The program should appear to freeze, depending on what you put in place of the 'Move comment.

    I still say that loop was just an example. Since you want to deal with user input, and other things, you wouldn't really use a loop at all. Every time the timer ticks, you'd move the bitmaps, deal with user input, check for collisions, then be done with it. The timer would be the loop.
    My usual boring signature: Nothing

  18. #18
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Yeah, now that I'm thinking of it you really need a managed game loop. I have an example of a managed game loop in 2 different locations. The first can be found in my signature under "My Snippet Website" and under articles. The second can be found in my signature under Game Programming Codebank Contributions.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  19. #19

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by Shaggy Hiker View Post
    Depending on what you pasted, you won't see the bitmaps move with this code anyways. Running a loop like that will block the UI thread from pumping messages. Therefore, it will prevent any invalidation messages from getting through, so the screen will never be painted. The program should appear to freeze, depending on what you put in place of the 'Move comment.

    I still say that loop was just an example. Since you want to deal with user input, and other things, you wouldn't really use a loop at all. Every time the timer ticks, you'd move the bitmaps, deal with user input, check for collisions, then be done with it. The timer would be the loop.
    So I should code in the timer1 section instead of using a loop to get the overall objective done. That is what you are getting at..

    Well I'm notsure how else to get the repeating pattern if not using a loop. If this loop code isn't the answer, how else should I get this done?

    Both image hit picbox 3, done, but then I want two new images which will obviously remain invisible, but load once those two are removed. But on top of that, the whole process repeats again.

    If PictureBox3.Bounds.IntersectsWith(PictureBox10.Bounds) Then
    Timer3.Stop()
    PictureBox3.Visible = False
    PictureBox10.Visible = False
    End If
    Would that in theory achieve my current goal?
    Last edited by pocket; Nov 6th, 2013 at 05:16 PM. Reason: Added code found via Search on VBforums

  20. #20
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Creating a loop for bitmap movements

    Yes, that is what I am getting at, though dday is right about the game loop. The problem with a timer is the time itself. The basic idea is that you want to do this:

    1) Get user input.
    2) Move the display items.
    3) Check for intersections and deal with any that occur.
    4) Goto 1

    If you have a timer, then each time it ticks it would do 1-3. Item 4 would be covered by the timer itself. However, if the timer ticks too slowly, the motion will appear very jerky. If the timer ticks too fast, there won't be sufficient time to get through items 1-3 before the timer ticks again. This is the reason for a game loop. The idea with that is to do items 1-3 and measure how long it took to do them. Step 4 becomes "Draw the screen", then step five is goto 1. By measuring how long it took to get through steps 1-4, you would know how much time has elapsed since the last time you went through the loop, and you'd move the objects accordingly in step 1. It's a more complex way of doing things, but vastly more efficient. After all, in the best circumstance with a timer, the computer will be sitting idle most of the time, waiting for the timer to tick again. If you tune that timer too tightly, though, your performance is likely to collapse as timer ticks begin to overlap one another. The game loop maximizes performance.
    My usual boring signature: Nothing

  21. #21

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    I'm not using any XNA, dday. I'm developing for a WM Pocket CE device.

  22. #22
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by pocket View Post
    I'm not using any XNA, dday. I'm developing for a WM Pocket CE device.
    Sorry, but I never said that you were, you're misunderstanding. The managed game loop isn't specifically for XNA, it's relevant to GDI+ too.

    Edit - Here is even an example of using the managed game loop with no GDI+ or XNA, just using a few pictureboxes:
    http://www.vbforums.com/showthread.p...=1#post4510137
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  23. #23

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Ah right, Hmm. When I read the article is referred to XNA that is obviously desktop related. I thought GDI+ was actual type up code. I haven't use any of that. That is much more complex for little ship designs. I had to use pictureboxes as the only alternative.

  24. #24
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by pocket View Post
    Ah right, Hmm. When I read the article is referred to XNA that is obviously desktop related. I thought GDI+ was actual type up code. I haven't use any of that. That is much more complex for little ship designs. I had to use pictureboxes as the only alternative.
    I think that at this point I'm going to back out of this thread. Still take a look at the link I posted in #22. Good luck to you.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  25. #25

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by dday9 View Post
    I think that at this point I'm going to back out of this thread. Still take a look at the link I posted in #22. Good luck to you.
    dday, well I've learnt that pictureboxes cannot be rotated. I had to make a few compromises for my little project, for educational purposes.

    Well I've read the code, still puzzeling.

  26. #26
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by pocket View Post
    dday, well I've learnt that pictureboxes cannot be rotated. I had to make a few compromises for my little project, for educational purposes.

    Well I've read the code, still puzzeling.
    The pictureboxes themselves can't be rotated, but the image inside of them can be. For example:
    Code:
            Dim b As Bitmap = DirectCast(PictureBox1.Image, Bitmap)
            b.RotateFlip(RotateFlipType.Rotate180FlipNone)
    
            PictureBox1.Image = b
    That code gives the appearance that the picturebox rotated 180 degrees.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  27. #27

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by dday9 View Post
    The pictureboxes themselves can't be rotated, but the image inside of them can be. For example:
    Code:
            Dim b As Bitmap = DirectCast(PictureBox1.Image, Bitmap)
            b.RotateFlip(RotateFlipType.Rotate180FlipNone)
    
            PictureBox1.Image = b
    That code gives the appearance that the picturebox rotated 180 degrees.
    The rotating of the image at any angle? But the picture box requires an updated image, right..?

    I can't open the bouncy ball file using VS 2003.

  28. #28
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by pocket View Post
    The rotating of the image at any angle? But the picture box requires an updated image, right..?
    If you want to rotate by any angle, rotate it by it's graphics:
    Code:
    Dim g As Graphics = Graphics.FromImage(Picturebox1.Image)
    g.RotateTransform(<your angle here>)
    g.Save()
    Quote Originally Posted by pocket View Post
    I can't open the bouncy ball file using VS2003
    Wow, 2003?! I guess to use the WM Pocket CE device correct? I don't think that it would compile 2003 as I think that I use LINQ.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  29. #29

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Yes, I ordered a VB.net programming book for CE on Amazon UK for £2.90, for reference on GDI+, may be for animation effect if possible. And button usage.

    But my concern was doing as I stated, but eventually after then creating a random missile sequence for the enemy ship. So straight right away once the program is loaded the missiles fire and hit the player controlled ship, even though it may not rotate, even if it did, not going anywhere. But never mind about that.

    The missile will have to be designed to hit the controlled ship on different variations, I guess in theory?

    Sort of like the Pong game sequence. Ofcourse different events and directions are taking place.

  30. #30

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Private quit As Boolean = False
    Private Sub gameloop()
    'update
    Call checkhit()
    If (ship2.Top + ship2.Height >= PictureBox3.Top) And (ship2.Top <= PictureBox3.Top + PictureBox3.Height) And (ship2.Left <= PictureBox3.Left + PictureBox3.Width) Then
    ship2.Visible = False
    Timer1.Enabled = True
    End If

    'loop
    If quit = False Then
    End If
    End Sub
    In bold that is one piece of the code for the program. Nothing happens.

    I also used just another If and End If for the debris. I only thought about that as I woke up not long after.

  31. #31
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Creating a loop for bitmap movements

    That looks like code for intersecting two rectangles. What else is it supposed to do? Did you put a breakpoint on that If statement and take a look at how it will evaluate? If nothing happens, the most likely reason is because the If evaluates to False.

    By the way, always use AndAlso and OrElse in place of And and Or unless you have good reason to do otherwise.
    My usual boring signature: Nothing

  32. #32

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by Shaggy Hiker View Post
    That looks like code for intersecting two rectangles. What else is it supposed to do? Did you put a breakpoint on that If statement and take a look at how it will evaluate? If nothing happens, the most likely reason is because the If evaluates to False.

    By the way, always use AndAlso and OrElse in place of And and Or unless you have good reason to do otherwise.
    As I've explained in my previous posts, my aim is getting two bitmaps hitting another, and then two other images loads, while the first two are removed. Which I have done.

    I now want to loop all this, so it is reoccuring infinately. Unless I close the program. Changing true or false on the game look doesn't change anything. It doesn't start again.

    I learned the If and End if statements from some old VB.net video tutorials. I have tried for Loops, but nothing helpful.

  33. #33
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Creating a loop for bitmap movements

    Use a while infinite loop, or a managed game loop. I've already shown you the managed game loop, if you don't want to take the time to study that and adjust it to your needs, take a stab a the while infinite loop. Here is an example of that:

    Pseudo Code:
    1. Private quit As Boolean = False
    2.  
    3. Private Sub StartLoop()
    4.    'This would be in a seperate thread so that it doesn't tie up the GUI
    5.    While quit = False
    6.       'Move your bitmaps
    7.    End While
    8. End Sub
    9.  
    10. Private Sub FormClosing(...) Handles Me.FormClosing
    11.    quit = True
    12. End Sub

    Everything in the While loop will execute until the variable quit equals True, which happens in the form_closing event.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  34. #34

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Re: Creating a loop for bitmap movements

    Quote Originally Posted by dday9 View Post
    Use a while infinite loop, or a managed game loop. I've already shown you the managed game loop, if you don't want to take the time to study that and adjust it to your needs, take a stab a the while infinite loop. Here is an example of that:

    Pseudo Code:
    1. Private quit As Boolean = False
    2.  
    3. Private Sub StartLoop()
    4.    'This would be in a seperate thread so that it doesn't tie up the GUI
    5.    While quit = False
    6.       'Move your bitmaps
    7.    End While
    8. End Sub
    9.  
    10. Private Sub FormClosing(...) Handles Me.FormClosing
    11.    quit = True
    12. End Sub

    Everything in the While loop will execute until the variable quit equals True, which happens in the form_closing event.
    I tried moving my code snippets around, with the managed game loop. The private boolean is declared at the top of my code form.

    And at the very bottom is the gameloop

    Code:
       Private Sub gameloop()
            'update
            Call checkhit()
            'loop
            If (ship2.Top + ship2.Height >= PictureBox3.Top) And (ship2.Top <= PictureBox3.Top + PictureBox3.Height) And (ship2.Left <= PictureBox3.Left + PictureBox3.Width) Then
                ship2.Visible = False
                Timer1.Enabled = True
            End If
            If (ship1.Top + ship1.Height >= PictureBox3.Top) And (ship1.Top <= PictureBox3.Top + PictureBox3.Height) And (ship1.Left <= PictureBox3.Left + PictureBox3.Width) Then
                ship1.Visible = False
                Timer1.Enabled = True
            End If
            If quit = True Then
            End If
        End Sub
    Additionally, can the alternative loop be helpful for missile firing by the CPU controlled bitmap.

  35. #35

    Thread Starter
    Member pocket's Avatar
    Join Date
    Oct 2013
    Location
    Greater London
    Posts
    37

    Unhappy Re: Creating a loop for bitmap movements

    I've tried this while loop,

    I placed the If and End if statements in the

    Code:
    Private quit As Boolean = False
    
        Private Sub StartLoop()
            checkhit()
            'This would be in a seperate thread so that it doesn't tie up the GUI
            While quit = False
                'Move your bitmaps
                If (ship2.Top + ship2.Height >= PictureBox3.Top) And (ship2.Top <= PictureBox3.Top + PictureBox3.Height) And (ship2.Left <= PictureBox3.Left + PictureBox3.Width) Then
                    ship2.Visible = False
                    Timer1.Enabled = True
                End If
                If (ship1.Top + ship1.Height >= PictureBox3.Top) And (ship1.Top <= PictureBox3.Top + PictureBox3.Height) And (ship1.Left <= PictureBox3.Left + PictureBox3.Width) Then
                    ship1.Visible = False
                    Timer1.Enabled = True
                End If
                If (ship1.Top + ship1.Height >= PictureBox3.Top) And (ship1.Top <= PictureBox3.Top + PictureBox3.Height) And (ship1.Left <= PictureBox3.Left + PictureBox3.Width) Then
                    PictureBox4.Visible = True
                    Timer1.Enabled = True
                End If
                If (ship2.Top + ship2.Height >= PictureBox3.Top) And (ship2.Top <= PictureBox3.Top + PictureBox3.Height) And (ship2.Left <= PictureBox3.Left + PictureBox3.Width) Then
                    PictureBox5.Visible = True
                    Timer1.Enabled = True
                End If
            End While
        End Sub
        Private Sub FormClosing(...) Handles Me.FormClosing
            quit = False
        End Sub
    What is the ...? form1? Handles Me.formclosing? Does that refer to a button pressed or the screen x to close.

    While loops, managed loops, bloody hula hoops! Flip flop loops!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width