←  Code Block

Fallout Studios Forums

»

[Visual Basic] Using a timer to swap betwe...

Ravager's Photo Ravager 14 May 2008

Well, I need some help...

The user selects an item from the combo box, then image 1 displays in the picture box. A timer is running in the background, so when it reaches "X", image 1 is replaced with image 2. When the timer reaches "X" again, Image 2 is replaced with Image 1.


Any and all help is appreciated, I'm a beginner at this btw.

Here's what I've got so far:



Quote

Private Sub tmrChangeMonsterImage_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrChangeMonsterImage.Tick

Const MAX_IMAGES As Integer = 33
Static newMonster As Integer = 0
Static stance As Integer


If newMonster = 1 Then
stance = 1
ElseIf newMonster = MAX_IMAGES + 1 Then
stance = +1
End If
newMonster += stance

'Displays next monster
Select Case newMonster
Case 1
Me.picMonster.Image = My.Resources.Zombie
Case 2
Me.picMonster.Image = My.Resources.Zombie_Attack
End Select

End Sub

Edited by Ravager, 14 May 2008 - 22:09.
Quote