-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ironman.frm
366 lines (358 loc) · 10.8 KB
/
Ironman.frm
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
VERSION 5.00
Begin VB.Form Form1
BackColor = &H80000007&
BorderStyle = 1 'Fixed Single
Caption = "Form1"
ClientHeight = 5010
ClientLeft = 45
ClientTop = 390
ClientWidth = 7875
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 573.63
ScaleMode = 0 'User
ScaleWidth = 420
StartUpPosition = 3 'Windows Default
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 240
Top = 4320
End
Begin VB.Frame Frame1
BackColor = &H00000000&
Caption = "INSTRUCTIONS"
BeginProperty Font
Name = "Cambria"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 1455
Left = 1920
TabIndex = 3
Top = 3360
Width = 4335
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "IRONMAN SPEED +2 At every 100'th SCORE"
BeginProperty Font
Name = "Cambria"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 120
TabIndex = 7
Top = 960
Width = 3975
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "Catch FUEL Score=6"
BeginProperty Font
Name = "Cambria"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 120
TabIndex = 6
Top = 720
Width = 4095
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "Catch ALIENS Score=-3"
BeginProperty Font
Name = "Cambria"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 120
TabIndex = 5
Top = 480
Width = 4095
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "Move RIGHT D Move LEFT S"
BeginProperty Font
Name = "Cambria"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 120
TabIndex = 4
Top = 240
Width = 3975
End
End
Begin VB.Image Image4
Height = 615
Left = 3600
Picture = "Ironman.frx":0000
Stretch = -1 'True
Top = 4200
Width = 615
End
Begin VB.Image Image3
Height = 975
Left = 4710
Picture = "Ironman.frx":22CB1
Stretch = -1 'True
Top = 720
Width = 1215
End
Begin VB.Image Image2
Height = 975
Left = 1950
Picture = "Ironman.frx":6033B
Stretch = -1 'True
Top = 720
Width = 1215
End
Begin VB.Image Image1
Height = 1500
Left = 3187
Picture = "Ironman.frx":9D9C5
Stretch = -1 'True
Top = 1800
Width = 1500
End
Begin VB.Label Label9
Alignment = 2 'Center
BackStyle = 0 'Transparent
BeginProperty Font
Name = "Cambria"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 6360
TabIndex = 9
Top = 720
Width = 1335
End
Begin VB.Label Label8
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "SPEED"
BeginProperty Font
Name = "Cambria"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFC0&
Height = 375
Left = 6360
TabIndex = 8
Top = 240
Width = 1335
End
Begin VB.Label Label3
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "IRONMAN"
BeginProperty Font
Name = "Cambria"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 735
Left = 2670
TabIndex = 2
Top = 960
Width = 2535
End
Begin VB.Label Label2
Alignment = 2 'Center
BackStyle = 0 'Transparent
BeginProperty Font
Name = "Cambria"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 1
Top = 720
Width = 1215
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "SCORE"
BeginProperty Font
Name = "Cambria"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 0
Top = 240
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i, c, score, speed As Integer
Dim a, f As String
Dim enms(2), food(2) As Image
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyD Then
Image4.Left = Image4.Left + speed
ElseIf KeyCode = vbKeyA Then
Image4.Left = Image4.Left - speed
End If
End Sub
Private Sub Form_Load()
c = 2
speed = 5
score = 0
a = "enemies"
f = "foods"
End Sub
Private Sub Image1_Click()
Label1.Visible = True
Label2.Visible = True
Label8.Visible = True
Label9.Visible = True
Label3.Visible = False
Image1.Visible = False
Image2.Visible = True
Image2.Visible = False
Image3.Visible = False
Frame1.Visible = False
createenemies (2)
createfood (2)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Label2.Caption = score
Label9.Caption = speed
For i = 0 To c
enms(i).Visible = True
food(i).Visible = True
enms(i).Top = enms(i).Top + 30
food(i).Top = food(i).Top + 30
If collision(enms(i), Image4) = True Then
score = score - 1
enms(i).Visible = False
End If
If collision(food(i), Image4) = True Then
food(i).Visible = False
score = score + 2
If score Mod 100 = 0 Then
speed = speed + 1
End If
End If
If enms(i).Top >= 600 Then
Randomize
enms(i).Left = (450 * Rnd())
food(i).Left = (450 * Rnd())
enms(i).Top = enms(i).Top - enms(i).Top + 1
food(i).Top = food(i).Top - food(i).Top + 1
End If
Next
End Sub
Private Function collision(ByVal object1 As Object, ByVal object2 As Object) As Boolean
If object1.Top + object1.Height >= object2.Top And _
object2.Top + object2.Height >= object1.Top And _
object1.Left + object1.Width >= object2.Left And _
object2.Left + object2.Width >= object1.Left And object1.Visible = True And object2.Visible = True Then
collision = True
Else
collision = False
End If
End Function
Private Sub createenemies(number)
Dim i As Integer
For i = 0 To number
Dim temp As Image
Set temp = Me.Controls.Add("VB.Image", "a" & i)
temp.Top = 2 * Rnd()
temp.Height = 40
temp.Width = 40
Randomize
temp.Left = (450 * Rnd())
temp.Stretch = True
temp.Picture = LoadPicture("C:\Users\admin\Desktop\frog.gif")
temp.Width = 40
temp.Width = 40
Set enms(i) = temp
enms(i).Visible = True
Next
End Sub
Private Sub createfood(number)
Dim i As Integer
For i = 0 To number
Dim temp As Image
Set temp = Me.Controls.Add("VB.Image", "f" & i)
temp.Top = 2 * Rnd()
Randomize
temp.Left = (450 * Rnd())
temp.Stretch = True
temp.Picture = LoadPicture("C:\Users\admin\Desktop\fire.gif")
temp.Width = 40
temp.Width = 40
Set food(i) = temp
food(i).Visible = True
Next
End Sub