New answers tagged

0

The array which contains your bullet (var bullets) is declared as a local variable within the shootGun() function. This already can't work on the conceptual level, because it means that the list of bullets which are currently active in your game area only lives during the execution of the shootGun function and is discarded afterwards. It needs to be a ...


0

So for collision detection and game development in general I suggest you start off with https://developer.mozilla.org/en-US/docs/Games/Techniques or https://www.w3schools.com/graphics/game_intro.asp The way you would do this is add a collision method in your component class like so: this.collison = function(rect2) { let rect1 = this; if (...


Top 50 recent answers are included