HitTest: Code for the movie

Modify the movie by adding code for hitting and missing the paddle.

var numHits:int=0;
function hitPaddle(): void {
   numHits++;
   lblHits.text=numHits.toString();
}
function missPaddle(): void {
   numHits--;
   if(numHits<0) numHits=0;
   else lblHits.text=numHits.toString();
}

Get Adobe Flash player

Download the movie.
INDEX, Detect if an object hit another, Detect if an object hit a target inside another, Catch a Falling Star Game, Add a paddle, Add code to movie for hit and miss, Modify FallingStar to hit and miss, Add code to move the paddle
Next lesson: Strings in ActionScript

Copyright © Zebra0.com
All rights reserved worldwide.

 
 

Add code to movie for hit and miss