danteAGAIN Posted June 8, 2017 Share Posted June 8, 2017 Hello everyone, can you told me why my code is not working ? i don't understand why is not working, i got inspired with this : https://phaser.io/examples/v2/input/keyboard-hotkeys my code: function preload(){ game.load.image('bulleRpg', 'assets/bulleRpg/bulleRpg.png'); } var spaceKey; function create(){ spaceKey = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); spaceKey.onDown.add(drawBulleRpg, this); } function drawBulleRpg() { game.add.sprite(game.world.centerX + 250, game.world.centerY + 150, 'bulleRpg'); } i want just display an image when i press the spacebar. Thx lot of Link to comment Share on other sites More sharing options...
rich Posted June 8, 2017 Share Posted June 8, 2017 Have you tried logging out your drawBullet function? It might be being called, but the Sprite may just not be visible, or is being moved off-screen somewhere. Link to comment Share on other sites More sharing options...
danteAGAIN Posted June 8, 2017 Author Share Posted June 8, 2017 Loool, you said right, it was off screen beause i have a big world. thx man Link to comment Share on other sites More sharing options...
Recommended Posts