Ayuda Powerups y Poder del jefe En Arkanoid
Publicado por Vicente (1 intervención) el 10/05/2019 04:05:43
Bueno, yo soy estudiante de Ingenieria Civil Industrial, y uno de mis ramos es programación con Visual Basic. La cosa que me dieron el trabajo de editar y mejorar el trabajo de otro compañero y ese trabajo era Arkanoid. El juego es simple pero mi profesor nos pidio agregar poderes y un jefe, pero que lo hicieramos todos por nosotros mismos, cosa que va en mal a peor tomando en cuenta que somos pesimos programando y apenas pasamos una asigantura de programacion con Python. Por eso pido vuestra ayuda para este principiante aprenda y desarrolle el programa, ya que me gustaria saber como colocar los poderes y hacer que el jefe haga invencibles los bloques por un periodo, pero lo he intentado todo lo que sabia y no puedo simplemente. Por favor ayuda.
Aqui va el codigo
Aqui va el codigo
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
Public Class Form2
Dim Vspeed As Single = 3 'VELOCIDAD BOLA VERTICAL
Dim Hspeed As Single = 3 'VELOCIDAD BOLA HORIZONTAL
Dim rows As Single = 11
Dim cols As Single = 10
Dim TopRow As Single = 0.1
Dim RowHeight As Single = 0.05
Dim score As Integer = 0
'Limitaciones bola con los margenes
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Bola.Top < 0 Then
Vspeed = -Vspeed
Sonido(3)
End If
If Bola.Left < 0 Or Bola.Right > 556 Then
Hspeed = -Hspeed : Sonido(4)
End If
Bola.Left += Hspeed
Bola.Top += Vspeed
If Bola.Bottom > Me.ClientRectangle.Height Then
Timer1.Enabled = False
Bola.Visible = False : Sonido(5)
Label5.Text -= 1
Button3.Visible = True
'perder
If Label5.Text = 0 Then
Gameover.Visible = True : Sonido(5)
Button1.Visible = True
Button3.Visible = False
'Button3.Enabled = False
'Label5.Text = 0
End If
End If
If Bola.Right > Me.ClientRectangle.Width Then
Vspeed = -Vspeed
End If
Dim C As Single = Bola.Left + Bola.Width / 2
If C > Nave.Left And C < Nave.Right And Vspeed > 0 And Bola.Bottom > Nave.Top And Bola.Top < Nave.Top Then
Vspeed = -Vspeed
Sonido(2)
'curve the bat
Dim offset As Single = (Bola.Left + Bola.Width / 2) / (Nave.Left + Nave.Width / 2)
Dim ratio As Single = offset / (Nave.Width / 2)
Hspeed += 3 * ratio
End If
For Each Cnt As Control In Me.Controls
If Cnt.Name = "brick" Then
checkbrick(Cnt, Bola)
End If
Next
For R As Integer = 0 To rows - 1
For F As Integer = 0 To cols - 1
Dim B As New Button
B.Visible = True
B.Name = "brick"
B.Width = Me.ClientRectangle.Width / cols
B.Height = Me.ClientRectangle.Height * RowHeight
B.Left = C * B.Width
B.Top = Me.ClientRectangle.Height * (TopRow + R * RowHeight)
If R = 10 Then
Enhancer.Visible = True
Enhancer.Top = B.Top
Enhancer.Left = B.Left
Timer2.Enabled = True
End If
Next
Next
End Sub
Private Sub checkbrick(ByVal brick As Button, ByVal Bola As Button)
Dim Hit As Boolean = False
If brick.Visible Then
Dim C As Single = Bola.Left + Bola.Width / 2
'choque lado inferior del ladrillo
If Vspeed < 0 And C > brick.Left And C < brick.Right And Bola.Top < brick.Bottom And Bola.Bottom > brick.Bottom Then
Vspeed = -Vspeed
Hit = True : Sonido(3)
End If
'choque lado superior del ladrillo
If Vspeed > 0 And C > brick.Left And C < brick.Right And Bola.Bottom > brick.Top And Bola.Top < brick.Top Then
Vspeed = -Vspeed
Hit = True : Sonido(3)
End If
C = Bola.Top + Bola.Height / 2
'choque lado izquierdo del ladrillo
If Hspeed > 0 And C > brick.Top And C < brick.Bottom And Bola.Right > brick.Left And Bola.Left < brick.Left Then
Hspeed = -Hspeed
Hit = True : Sonido(4)
End If
'cHoque lado derecho del ladrillo
If Hspeed < 0 And C > brick.Top And C < brick.Bottom And Bola.Left < brick.Right And Bola.Right > brick.Right Then
Hspeed = -Hspeed
Hit = True : Sonido(4)
End If
If Hit Then
brick.Visible = False
score += 5
Label1.Text = score.ToString
End If
If score = 550 Or Bola.Bounds.IntersectsWith(Boss.Bounds) Then
Timer1.Enabled = False
win.Visible = True
Button1.Visible = True
End If
End If
End Sub
'CONTROLAR CON EL MOUSE Y DIMENSIONAR LA NAVE
Private Sub Form2_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseMove
Nave.Width = 0.2 * Me.ClientRectangle.Width
Nave.Height = 0.05 * Me.ClientRectangle.Height
Nave.Top = 0.95 * Me.ClientRectangle.Height
Nave.Left = e.X - (0.15 * Me.ClientRectangle.Width)
End Sub
'CARGAR PANTALLA<
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
Makebrick()
' Centrar la Pantalla
Me.SetBounds(((System.Windows.Forms.Screen.GetBounds(Me).Width) - (Me.Width)) / 2,
((System.Windows.Forms.Screen.GetBounds(Me).Height) - (Me.Height)) / 2,
Me.Width, Me.Height, BoundsSpecified.All)
End Sub
'MATRIZ PARA CREAR LOS LADRILLOS
Private Sub Makebrick()
Sonido(1)
Label5.Text = 3
'resetear juego
For i As Integer = Me.Controls.Count - 1 To 0 Step -1
If Me.Controls(i).Name = "brick" Then
Me.Controls.RemoveAt(i)
End If
Next
For R As Integer = 0 To rows - 1
For C As Integer = 0 To cols - 1
Dim B As New Button
Me.Controls.Add(B)
B.Visible = True
B.Name = "brick"
B.Width = Me.ClientRectangle.Width / cols
B.Height = Me.ClientRectangle.Height * RowHeight
B.Left = C * B.Width
B.Top = Me.ClientRectangle.Height * (TopRow + R * RowHeight)
'COLOR Y DISEÑO DE LOS LADRILLOS
B.BackColor = Color.Blue
If R = 0 Then
If C = 2 Or C = 7 Then
B.BackColor = Color.Yellow
End If
ElseIf R = 1 Then
If C = 3 Or C = 6 Then
B.BackColor = Color.Yellow
End If
ElseIf R = 2 Then
If C = 3 Or C = 4 Or C = 5 Or C = 6 Then
B.BackColor = Color.Red
End If
ElseIf R = 3 Or R = 4 Then
If C = 2 Or C = 4 Or C = 5 Or C = 7 Then
B.BackColor = Color.Red
End If
If C = 3 Or C = 6 Then
B.BackColor = Color.Gray
End If
ElseIf R = 5 Or R = 6 Or R = 7 Then
If C = 1 Or C = 2 Or C = 3 Or C = 4 Or C = 5 Or C = 6 Or C = 7 Or C = 8 Then
B.BackColor = Color.Red
End If
ElseIf R = 8 Then
If C = 1 Or C = 3 Or C = 4 Or C = 5 Or C = 6 Or C = 8 Then
B.BackColor = Color.Red
End If
ElseIf R = 9 Then
If C = 1 Or C = 3 Or C = 6 Or C = 8 Then
B.BackColor = Color.Red
End If
ElseIf R = 10 Then
If C = 4 Or C = 5 Then
B.BackColor = Color.Gray
End If
End If
'B.FlatStyle = FlatStyle.Flat
Next
Next
With Bola
.Visible = True
.Left = Me.ClientRectangle.Width / 2
.Top = Me.ClientRectangle.Height * 0.9
Vspeed = 3
Hspeed = 3
Button1.Visible = False
Gameover.Visible = False
score = 0
Label1.Text = 0
End With
End Sub
Private Sub Form2_MouseClick(sender As Object, e As MouseEventArgs) Handles Me.MouseClick
Timer1.Enabled = True
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Makebrick()
End Sub
Private Sub Sonido(ByVal Son As Short)
My.Computer.Audio.Stop()
If Son = 1 Then My.Computer.Audio.Play(My.Resources.SonidoInicio, AudioPlayMode.Background)
If Son = 2 Then My.Computer.Audio.Play(My.Resources.shot, AudioPlayMode.Background)
If Son = 3 Then My.Computer.Audio.Play(My.Resources.SonidoLadrillo1, AudioPlayMode.Background)
If Son = 4 Then My.Computer.Audio.Play(My.Resources.SonidoLadrillo2, AudioPlayMode.Background)
If Son = 5 Then My.Computer.Audio.Play(My.Resources.SonidoPerder, AudioPlayMode.Background)
If Son = 6 Then My.Computer.Audio.Play(My.Resources.Electro_Potato_Arkanoid__Ending_Theme_Cover_, AudioPlayMode.Background)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Button3.Visible = False : Bola.Visible = True
Bola.Location = New Point(268, 400)
End Sub
Private Sub soltar()
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
Large.Top += 2
Sh.Top += 2
Enhancer.Top += 2
If Large.Bottom > Me.ClientRectangle.Height Then
Large.Visible = False
Timer2.Enabled = False
End If
If Sh.Bottom > Me.ClientRectangle.Height Then
Sh.Visible = False
Timer2.Enabled = False
End If
If Enhancer.Bottom > Me.ClientRectangle.Height Then
Enhancer.Visible = False
Timer2.Enabled = False
End If
If Large.Bounds.IntersectsWith(Nave.Bounds) Then
Nave.Width = Nave.Width * 2
Timer2.Enabled = False
End If
If Sh.Bounds.IntersectsWith(Nave.Bounds) Then
Nave.Width = Nave.Width / 2
Timer2.Enabled = False
End If
If Enhancer.Bounds.IntersectsWith(Nave.Bounds) Then
Vspeed += 1
Hspeed += 1
Timer2.Enabled = False
End If
End Sub
End Class
Valora esta pregunta


0