Creating a race-type game, is it possible once a picture box passes a certain x,y location it can stop the game?

  • Thread starter Thread starter thekarlster
  • Start date Start date
T

thekarlster

Guest
Basically, I am creating a game where the user races against the timer by clicking a 'Swim' button over and over to move the picture box over 10 pixels. I have two other 'swimmers' moving over with Mod on the timer (decoration). I was wondering if at a certain location (1048, 391), an event procedure on a label could be made to stop the game when the picturebox passes the point. I am fairly new to programming so if this does not belong on this forum I apologize!

Dim timer As Integer

Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click

Timer = 0
txtTimer.Text = timer
Timer1.Enabled = True
End Sub
Private Sub btnSwim_Click(sender As Object, e As EventArgs) Handles btnSwim.Click
picSwimmer.Left += 10
End Sub


Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
timer = timer + 1
txtTimer.Text = timer

Dim x As Integer
x = timer Mod 3
If (x = 0) Then
picOpponent1.Left += 25
picOpponent2.Left += 30
ElseIf (x = 1) Then
picOpponent1.Left += 40
picOpponent2.Left += 30
ElseIf (x = 2) Then
picOpponent1.Left += 30
picOpponent2.Left += 60
End If
End Sub

Continue reading...
 
Back
Top