No me sirvió.....Alguien puede ayudarme????????
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúImports System
Imports System.Timers
Public Class Timerclase
Private Shared aTimer As New System.Windows.Forms.Timer()
Shared villa1 As Villano
Shared villa2 As Villano
Shared villa3 As Villano
Shared heroe As Heroe
Private Shared Sub timermovervillanos(ByVal myObject As Object, _
ByVal myEventsArgs As EventArgs)
If heroe.GetMuerto = False Then
If villa1.GetMuerto = False Then
villa1.move()
End If
If villa2.GetMuerto = False Then
villa2.move()
End If
If villa3.GetMuerto = False Then
villa3.move()
End If
End If
main()
End Sub
Public Shared Sub main()
AddHandler aTimer.Tick, AddressOf timermovervillanos
aTimer.Enabled = True
aTimer.Interval = 500
aTimer.Start()
End Sub
End Class
con un timer arrastrado desde controles y poniendo solo los if me va pero yo quiero controlar este timer para que luego lo llame en un metodo y funcione,
Private Sub Form2_KeyDown(...) Handles MyBase.KeyDown
Select Case e.KeyCode
Case Keys.Up
[b]_tablero.MoveUpH()[/b] -->[i] lo que pretendo con esta función es mover este objeto [b]( Picturebox)[/b] en mi tablelayout hacia arriba, del cual le he asignado unas dimensiones de 8X8, y el metodo de arriba [b]actualize la interfaz para moverlo por su tablero de las dimensiones dichas[/b].[/i]
End Select
Function moveUpH(ByVal heroe As Heroe) As Boolean
Dim coord = calculaCoordenada(heroe, 0, -1)
Return moveH(heroe, coord)
End Function
Function moveH(ByVal heroe As Heroe, ByVal c As Coordenadas) As Boolean
' Aquí lo que se hace cuando se mueve el héroe
If (TypeOf (e) Is Bloques) Then
Return False
ElseIf (TypeOf (p) Is Pastillas) Then
If (TypeOf (p) Is PastillaNormal) Then
' la consumo
Return True
ElseIf (TypeOf (p) Is Vitamina) Then
' Gano al villano
Return True
End If
End If
If (TypeOf (e) Is Villano) Then
' Duelo
Return False
End If
Return True
End Function