1 decade ago by Nico
Hey guys, so I'm playing around with one of my longterm game projects today and I'm trying to make an ammo crate which seems like it should be pretty simple.
I setup grenades and bullets as global variables in main.js and have it setup so that the player can't shoot anything unless his ammo count is greater than 0. I have setup the ammo box to kill itself when it collides with the player as well as log the new ammo count to the console.
It's logging correctly and the game continues to run fine when I pick up the ammo but then when I try to shoot the game crashes with this error:
TypeError: 'true' is not a constructor (evaluating 'new (entityClass)( x, y, settings || {} )') game.js line: 131
I would greatly appreciate if anyone could shed some light on this for me. Happy to post any code that would help.
Thanks
-N
I setup grenades and bullets as global variables in main.js and have it setup so that the player can't shoot anything unless his ammo count is greater than 0. I have setup the ammo box to kill itself when it collides with the player as well as log the new ammo count to the console.
It's logging correctly and the game continues to run fine when I pick up the ammo but then when I try to shoot the game crashes with this error:
TypeError: 'true' is not a constructor (evaluating 'new (entityClass)( x, y, settings || {} )') game.js line: 131
I would greatly appreciate if anyone could shed some light on this for me. Happy to post any code that would help.
Thanks
-N