i trying spawn enemies @ random intervals when write code commented below screen turns white , canvas off , enemies spawned @ random location instead @ top position declared.please check code commented , let me know doing wrong.
https://jsfiddle.net/rz7udd72/
}
// function animateplanets() { // var time = date.now(); // if (time > lastspawn + spawntime) { // lastspawn = time; // spawnplanets(); // } // canvascontext.clearrect(0,0,canvas.width, canvas.height); // for(var i=0; < planets.length; i++){ // var planet = planets[i]; // planet.y += planetspeedy; // canvascontext.beginpath(); // canvascontext.arc(planet.x, planet.y, planetradius, 0, math.pi * 2, false); // canvascontext.fillstyle = 'red'; // canvascontext.fill(); // canvascontext.closepath(); // } // }
Comments
Post a Comment