Graphics Programs Reference
In-Depth Information
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
function getTime()
{ // extract the seconds from the newDate object
newDate = new Date();
mySecond = newDate.getSeconds();
// adjustment for second hand going past 12
if ( mySecond== 0 && startTime > 0 ) {startTime -= 60 }
// find elapsed time and time remaining
elapsedTime = Math.abs(mySecond - startTime);
time = 30 - elapsedTime;
// display the time remaining
if (time < 10 ) { time_txt.text = "0" + time; }
else time_txt.text = time;
};
function hitCheck()
{ // check if both lasers hit the object
if ( thisObj.hitTest(xloc,yloc) && hit == 1)
{
thisObj.gotoAndPlay(2); // explode the asteroid
score++; // update the score
if (score < 10 ) { score_txt.text = "0" + score;}
else score_txt.text = score;
hit = 2;
break;
}
}
function cleanUp()
{ // reset the cursor
Mouse.show();
target_mc.swapDepths(tdepth);
target_mc._x = target_mc._y = -100;
// get rid of the asteroids
for (var i:Number = 0; i < numObjects; i++)
{
removeMovieClip(_root["object"+i]);
_root["object"+i]._visible = false;
}
}
Search WWH ::




Custom Search