waatz Posted February 21, 2014 Share Posted February 21, 2014 Hello, I'm a beginner who is trying to make a game with phaser and i'm stuck.As you can see here : LINKIf you fire a bullet without overlap anything its fine but when you fire multiple bullet in a platform the bullet get bugged and i don't know why.function create(){ bullets = game.add.group(); bullets.createMultiple(15, 'bullet'); bullets.setAll('outOfBoundsKill', true); game.input.onDown.add(shoot, this);}function shoot(){ bullet = bullets.getFirstExists(false); if (bullet){ bullet.reset(player.x, player.y); game.physics.moveToPointer(bullet, 500); }}function update(){ game.physics.overlap(bullets, platforms, platformHit, null, this);}function platformHit(bullet){ bullet.kill();}What i did wrong?Thanks Link to comment Share on other sites More sharing options...
waatz Posted February 22, 2014 Author Share Posted February 22, 2014 I'm always stuck on this.. I have do some test and i found something.. the overlap function works (platformHit function is trigger and the bullet is killed) but the bullet isnt draw.Anyone know why my bullet isnt draw correctly?Thanks Link to comment Share on other sites More sharing options...
waatz Posted February 23, 2014 Author Share Posted February 23, 2014 Problem fixed.I don't know if its the best way for what i want but it work.function create(){ bullets = game.add.group(); bullets.createMultiple(1, 'bullet'); bullets.setAll('outOfBoundsKill', true); game.input.onDown.add(shoot, this);}function shoot(){ bullet = bullets.create(player.x, player.y, 'bullet'); bullet.game.physics.moveToPointer(bullet, 500)} Link to comment Share on other sites More sharing options...
jpdev Posted February 23, 2014 Share Posted February 23, 2014 The solution code looks like you will be creating an unlimited amount of bullet sprites (and never reuse them).So if the player shoots 1000 times, you will have 1000 bullets in your group. (Since mostly all of them will be "dead" and no longer invisible it might not impact performance that much, but it's definitively not ideal.) Link to comment Share on other sites More sharing options...
AlexArroyoDuque Posted February 23, 2014 Share Posted February 23, 2014 Hi!I have the same problem and I have seen some post talking about it. It is a bug? When my shots collide with a group of platforms, the function should be executed not executed. Now I use version 1.1.5. This did not happen in version 1.1.3. Link to comment Share on other sites More sharing options...
Recommended Posts