Answered Score...

PRo-Beaniie

Well-known member
Joined
Mar 17, 2011
Messages
55
Location
Hertford, Hertfordshire, United Kingdom
Programming Experience
3-5
Hey Guys,

I have been trying to link my scoreboard to a progress bar, i have managed to link the progress bar to the score value however. if i score over the progress bar limit i enter debugging mode a little help with this would be much appreciated ... :)

here is my complete collision code along with my score code.

VB.NET:
    Private Sub CheckHit()
        For Me.x = 1 To NumOfEnemy
            'Timer Main Collision Code ...
            If (Shot.Top + Shot.Height >= Enemy(x).Top) And (Shot.Top <= Enemy(x).Top + Enemy(x).Height) And (Shot.Left + Shot.Width >= Enemy(x).Left) And (Shot.Left <= Enemy(x).Left + Enemy(x).Width) And Enemy(x).Visible = True Then
                My.Computer.Audio.Play("invaderkilled.wav")
                Enemy(x).Visible = False
                Enemy(x).Top = -100
                Shot.Visible = False
                ShotDown += 1
                Shot.Top = -1000
                Enemy(x).Visible = True
                EnemySpeed = EnemySpeed + 0.5
                Score = Score + 175
                scoreBoard.Text = Score
                SCOREBAR.Value = scoreBoard.Text
            End If

            If Enemy(x).Top < Me.ClientRectangle.Top + -70 Then
                Enemy(x).Left = Int((550) * Rnd() + 1)
            End If
        Next
        If scoreBoard.Text = 5000 Then
            TimerMain.Enabled = False
            DistanceTimer.Enabled = False
            MsgBox(" Well Done Commander They're Retreating")
        End If
    End Sub
 
Last edited:
something like:

VB.NET:
If cint(scoreBoard.text) > scoreBar.Maximum then
'you are over the max
elseif cint(scoreBoard.text) < scoreBar.min then
'you are under the min
end if

I always used to the step function in the progress bar but prior to setting the value of the progress bar you should make sure the value falls into the correct range.
 
Back
Top