javascript - Spawning Enemies not working in canvas -


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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -