nothing Posted September 6, 2017 Share Posted September 6, 2017 weapon.loadTexture("weapon2"); /\ | I have this, but its saying this Quote Uncaught TypeError: weapon.loadTexture is not a function at ballHitWeapon (gameex.js:246) at Function.<anonymous> (gameex.js:262) at c.Physics.Arcade.collideSpriteVsSprite (phaser.min.js:3) at c.Physics.Arcade.collideSpriteVsGroup (phaser.min.js:3) at c.Physics.Arcade.collideHandler (phaser.min.js:3) at c.Physics.Arcade.overlap (phaser.min.js:3) at colide1 (gameex.js:262) at Object.update (gameex.js:52) at c.StateManager.update (phaser.min.js:3) at c.Game.updateLogic I don't know if I do anything wrong or there is different function. Thank you for all answers Link to comment Share on other sites More sharing options...
Taz Posted September 6, 2017 Share Posted September 6, 2017 Setting the bulletKey property should change the texture for new bullets if that's what you're after: weapon.bulletKey = "weapon2"; Link to comment Share on other sites More sharing options...
nothing Posted September 6, 2017 Author Share Posted September 6, 2017 Hi, this doesn't work. The sprite didn't changed after this I tryed alert(weapon.bulletKey) and it says "weapon2". Variable changed successfully. Link to comment Share on other sites More sharing options...
Taz Posted September 6, 2017 Share Posted September 6, 2017 Hmm, that's odd, IDK why it doesn't work (it should i think). Anyway this way here does work, manually destroying and re-creating the bullets with the new key: weapon.bullets.destroy(); weapon.bullets = null; weapon.createBullets(3, "weapon2"); // change 3 to however many max bullets you want fired... nothing 1 Link to comment Share on other sites More sharing options...
nothing Posted September 6, 2017 Author Share Posted September 6, 2017 Oh yeah, It's work thank you. Link to comment Share on other sites More sharing options...
Recommended Posts