• Content count

  • Joined

  • Last visited

  1. Download the file HealthMeter.js and put the file in your game (dont remember to add the file html //// script src="../healthMeter.js"). you can see a exemple on gitHub , https://github.com/matthiaswh/phaser-health-meter/blob/master/examples/example.js , line (79-92) .
  2. I am in the infinite loop, i have write console.log("test") like this : update(){ if (this.game.input.onDown && this.atkBool == true){ var anim = this.player.animations.play('atk'); console.log("test") } In the console i can see a infinite loop and i don't know why .... if anyone can help me, it's will nice
  3. thx to try help me, I have try "false", but the animation don't stop again. I have try to add : this.player.animations.stop() and this.atkBool = false; but just 1 frame is display (529);
  4. hello, I need your help guy, i would create an animation with my character. When i push left click (mouse), the animation start but she is infinite. How stop my animation? my code: create: function() { this.player.animations.add('atk', [529, 532, 535, 538, 541], 10); this.game.input.onDown.add(this.atk, this); }, atk: function(){ this.atkBool = true; }, update(){ if (this.game.input.onDown && this.atkBool == true){ var anim = this.player.animations.play('atk'); } I want just 1 loop so stop animation after my "541" frames. Sorry for my english langage. I hope you can help me. Good day
  5. i can get inside the function but the animation doesn't work. I haven't error message in console.
  6. Hello everyone, I need your help , i try create a "rpg game" . I want use the left click (mouse1) for auto atk with my hero. my code: create: function(){ this.player.animations.add('atk', [529, 532, 535, 538, 541], 10, true); } update: function(){ if(game.input.activePointer.isDown){ this.player.animations.play('atk'); } with this code i need to keep my left click to push for see the action. And i want just to push 1 time. Sorry my english is very bad.
  7. Loool, you said right, it was off screen beause i have a big world. thx man
  8. 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
  9. thx you man ^^
  10. Hello everyone, I need help, i want display an element of a tileset, but i don't understand how to do that. function preload() this.game.load.image('stone', 'assets/tiles/tiless.png'); function create() this.stone = this.game.add.image(720, 78, 'stone'); i guess , i need a key or other but i don't understand how write and found this key. my tileset is 32*32
  11. My problem is resolved , i need to write: map.setCollisionBetween(234, 235, true, layer2) ===> i's important to write true and layer2 If someone need this answer.
  12. but I think is not my problem because my character can run and stop. I dont know why, i can collide my layer( who is my background) but i cant collide my second layer (tree, montain..)
  13. Hello everyone, I am beginner with phaser, i am French and my english is not very nice. I need your help, i am blocked on a collide function. I want my character to collide with my second layer (tree, montain, statue..). (i use tiled map editor and export in json). my code : function preload: game.load.tilemap('map', 'assets/tilemaps/maps/map.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tiles', 'assets/tiles/tiles.png'); game.load.spritesheet('perso', 'assets/sprite/spritetest.png', 32, 47); function create : game.physics.startSystem(Phaser.Physics.ARCADE); map = game.add.tilemap('map'); map.addTilesetImage('tiles'); layer = map.createLayer('layer1'); layer2 = map.createLayer('layer2'); layer2.resizeWorld(); map.setCollisionBetween(0,2000); //PLAYER // ajout player et parametre player = game.add.sprite(250, 50, 'perso'); // We need to enable physics on the player game.physics.arcade.enable(player, Phaser.Physics.ARCADE); function update : game.physics.arcade.collide(player, layer2); i show an image for understand my problem. Thx to read my message