This repository was archived by the owner on Sep 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLeagueInvadersPt.9ObjectManager.html
More file actions
244 lines (221 loc) · 6.41 KB
/
Copy pathLeagueInvadersPt.9ObjectManager.html
File metadata and controls
244 lines (221 loc) · 6.41 KB
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
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<style type="text/css">
ol {
margin: 0;
padding: 0
}
table td,
table th {
padding: 0
}
.c2 {
padding-top: 0pt;
padding-bottom: 0pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left;
height: 11pt
}
.c4 {
padding-top: 0pt;
padding-bottom: 0pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: center;
height: 11pt
}
.c6 {
color: #000000;
font-weight: 400;
text-decoration: none;
vertical-align: baseline;
font-size: 14pt;
font-family: "Arial";
font-style: normal
}
.c0 {
color: #000000;
font-weight: 400;
text-decoration: none;
vertical-align: baseline;
font-size: 11pt;
font-family: "Arial";
font-style: normal
}
.c8 {
font-weight: 400;
text-decoration: none;
vertical-align: baseline;
font-size: 11pt;
font-family: "Arial";
font-style: normal
}
.c3 {
padding-top: 0pt;
padding-bottom: 0pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: left
}
.c7 {
padding-top: 0pt;
padding-bottom: 0pt;
line-height: 1.15;
orphans: 2;
widows: 2;
text-align: center
}
.c5 {
background-color: #ffffff;
max-width: 468pt;
padding: 72pt 72pt 72pt 72pt
}
.c1 {
color: #0000ff
}
.title {
padding-top: 0pt;
color: #000000;
font-size: 26pt;
padding-bottom: 3pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
.subtitle {
padding-top: 0pt;
color: #666666;
font-size: 15pt;
padding-bottom: 16pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
li {
color: #000000;
font-size: 11pt;
font-family: "Arial"
}
p {
margin: 0;
color: #000000;
font-size: 11pt;
font-family: "Arial"
}
h1 {
padding-top: 20pt;
color: #000000;
font-size: 20pt;
padding-bottom: 6pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h2 {
padding-top: 18pt;
color: #000000;
font-size: 16pt;
padding-bottom: 6pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h3 {
padding-top: 16pt;
color: #434343;
font-size: 14pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h4 {
padding-top: 14pt;
color: #666666;
font-size: 12pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h5 {
padding-top: 12pt;
color: #666666;
font-size: 11pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
orphans: 2;
widows: 2;
text-align: left
}
h6 {
padding-top: 12pt;
color: #666666;
font-size: 11pt;
padding-bottom: 4pt;
font-family: "Arial";
line-height: 1.15;
page-break-after: avoid;
font-style: italic;
orphans: 2;
widows: 2;
text-align: left
}
</style>
</head>
<body class="c5">
<p class="c7"><span class="c6">League Invaders Pt. 9 </span></p>
<p class="c7"><span class="c6">ObjectManager</span></p>
<p class="c4"><span class="c6"></span></p>
<p class="c3"><span>1. Go to your GameObject class. Create a boolean member variable called </span><span class="c1">isAlive</span><span class="c0">. This will let us know when a particular game object no longer needs to be saved in memory. Initialize it to true since all our game objects will start out alive.</span></p>
<p
class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">2. Create a new class called ObjectManager</span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">3. In the member variables, create a Rocketship object but DO NOT INITIALIZE IT.</span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">4. Change the ObjectManager constructor so that it takes in a Rocketship object and use that to initialize the Rocketship member object. </span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">5. Create a method called update that calls the update method from the Rocketship object.</span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">6. Create a method called draw that takes in a Graphics object. This method then calls the draw method from the Rocketship object, passing in the graphics object. </span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span>7. Inside the GamePanel class, create and initialize an object of the ObjectManager class. Don't forget to pass in the GamePanel's Rocketship object.</span></p>
<p class="c2"><span class="c8 c1"></span></p>
<p class="c3"><span class="c0">8. In the updateGameState method, delete the call to the update method of the Rocketship class. </span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">9. In the updateGameState method, use your ObjectManager object to call its update method.</span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">10. In the drawGameState method, replace the call to the Rocketship draw method to a call to the draw method of the ObjectManager. Don't forget to pass in the Graphics object.</span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c3"><span class="c0">11. Run your game. You should see no change from Pt. 8.</span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c2"><span class="c0"></span></p>
<p class="c2"><span class="c0"></span></p>
</body>
</html>