Back to StarCatcher Project
StarCatcher - JS file additions
Additional Scripts Four
Instructions:
Copy and paste this first block of code inside our star class at the top of the js file. You need to be sure that there is a comma seperating each command line when you do this.
// add this to the variable list at the top of the star class _visible: true, // and this just below the other functions in the star class visible: function() { return this._visible; },
Instructions:
Next, use the block of code below to check if each star is visible before displaying it to the screen. This needs to surround the line of code with the curly brackets { ctx.drawImage(starsArray[i]._img, ......) }.
// this checks to see if the star is visible if (starArray[i].visible())