Jump to content


[Visual Basic] Using a timer to swap between 2 images


No replies to this topic

#1 Ravager

    Visitor

  • Member
  • 30 posts

Posted 14 May 2008 - 22:03

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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users