
AYUDA juego estilo Mario Bros !!
Publicado por David (3 intervenciones) el 17/04/2015 12:21:21
Me gustaria saber como hacer para que cuando Personaje se choque con Cactus_1, Personaje vuelva al principio de la pantalla.
PD: Adjunto cogido, si se necesita mas información contactar porfavor !!
Muchas Gracias.
PD: Adjunto cogido, si se necesita mas información contactar porfavor !!
Muchas Gracias.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Public Class frmPantalla
Private Sub TimerSuelo_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerSuelo1.Tick
Suelo.Left -= 10
If Suelo.Left <= -Width Then
Suelo.Left = Width
End If
End Sub
Private Sub TimerSuelo2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerSuelo2.Tick
Suelo2.Left -= 10
If Suelo2.Left <= -Width Then
Suelo2.Left = Width
End If
End Sub
Private Sub TimerCactus1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCactus1.Tick
Cactus_1.Left -= 10
If Cactus_1.Left <= -Width Then
Cactus_1.Left = Width
End If
End Sub
Private Sub TimerCactus2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCactus2.Tick
Cactus_2.Left -= 10
If Cactus_2.Left <= -Width Then
Cactus_2.Left = Width
End If
End Sub
Private Sub TimerCactus3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCactus3.Tick
Cactus_3.Left -= 10
If Cactus_3.Left <= -Width Then
Cactus_3.Left = Width
End If
End Sub
Private Sub TimerCactus4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCactus4.Tick
Cactus_4.Left -= 10
If Cactus_4.Left <= -Width Then
Cactus_4.Left = Width
End If
End Sub
Private Sub TimerCastillo_Tick(sender As System.Object, e As System.EventArgs) Handles TimerCastillo.Tick
Castillo.Left -= 10
If Castillo.Left <= -Width Then
Castillo.Left = Width
End If
End Sub
Private WithEvents timerSalto As New Timer With {.Enabled = True, .Interval = 100}
Private totalUnidades As Integer = 0
Private unidadesActuales As Integer = 0
Private salto As estadoSalto = estadoSalto.Terminado
Private Enum estadoSalto
Subiendo
Bajando
Terminado
End Enum
Private Enum unidadesSalto
Noventa
Cien
CientoCincuenta
Doscientos
End Enum
Private Sub timerSalto_Tick() Handles timerSalto.Tick
Dim localizacionX As Integer
Dim localizacionY As Integer
Select Case salto
Case estadoSalto.Bajando
unidadesActuales = unidadesActuales - 90
localizacionX = Personaje.Location.X
localizacionY = Personaje.Location.Y + 90
Personaje.Location = New Point(localizacionX, localizacionY)
If unidadesActuales = 0 Then
salto = estadoSalto.Terminado
End If
Case estadoSalto.Subiendo
unidadesActuales = unidadesActuales - 90
localizacionX = Personaje.Location.X
localizacionY = Personaje.Location.Y - 90
Personaje.Location = New Point(localizacionX, localizacionY)
If unidadesActuales = 0 Then
unidadesActuales = totalUnidades
salto = estadoSalto.Bajando
End If
Case estadoSalto.Terminado
timerSalto.Stop()
End Select
End Sub
Private Sub saltoPersonaje(unidades As unidadesSalto)
Select Case unidades
Case unidadesSalto.Cien
totalUnidades = 100
unidadesActuales = 100
Case unidadesSalto.CientoCincuenta
totalUnidades = 150
unidadesActuales = 150
Case unidadesSalto.Noventa
totalUnidades = 90
unidadesActuales = 90
Case unidadesSalto.CientoCincuenta
totalUnidades = 150
unidadesActuales = 150
End Select
salto = estadoSalto.Subiendo
timerSalto.Start()
End Sub
Private Sub frmPantalla_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Space Then
If salto = estadoSalto.Terminado Then
saltoPersonaje(unidadesSalto.Noventa)
End If
End If
End Sub
Valora esta pregunta


0