Search the Community

Showing results for tags 'damage'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 3 results

  1. Group of enemies don't take damage

    Hello! I have a group of enemies following the player, and I want when they are overlapping with the player and I press Q they take an amount of damage setted before. this is the part of the create function where I create the group this.enemies = game.add.group(); this.enemies.enableBody = true; this.enemies.setAll('body.immovable', true); this.enemies.createMultiple(5,"vikingo") this.enemies.children[0,1,2,3,4].health = 100; console.log(this.enemies.children[0,1,2,3,4].health) Here's the function I'm trying to use. Before I used the same syntax with a single sprite and went perfectly. In this case the console throws "Uncaught ReferenceError: i is not defined" matar: function(){ if(this.player.scale.x == 1 && this.Q.justDown && game.physics.arcade.overlap(this.player, this.enemies)) { this.enemies.children[i].damage(25); game.physics.arcade.moveToXY(this.enemies.children[i],15,2500,-300,0) console.log(this.enemies.children[i].health) } if(this.player.scale.x == -1 && this.Q.justDown && game.physics.arcade.overlap(this.player, this.enemies)){ this.enemies.children[i].damage(25); game.physics.arcade.moveToXY(this.enemies.children[i],-15,-2500,300,0) console.log(this.enemies.children[i].health) } }, I tested some other ways like changing children with children[0,1,2,3,4] but instead of throwing error I get "health = 100" all the time.
  2. Hi guys, I'm really new to Phaser and programing in general so I'm getting stuck really often with my first game. What I'm trying to do is some sort of a two players fighting game (this is a game for gamepads and keyboards, no mobile here). I kinda have the basics going, I mean, my characters move! But i have a list of things to do that keeps growing! Here I have my first two problems for you, kind people: Problem number 1: The thing I'm trying to do is to have my character perform a special move with a combination of buttons. I'm guessing there should be a timer involved somehow. The idea is that if you press button 1 and quickly press button 2 and 3, a special move will happen (a set of frames of my animation sheet) but if you don't press them fast enough, then you will have the animations for each instead (button 1 is used for punching, button 2 is used for kicking and button 3 for blocking). Problem number 2: How can the punch o the kick hit player 2? I have the two sprits on screen, each of them are moving but they don't hit each other. I would need to have some sort of lifemeter or something, one for each player, and a value for punching, kicking and any other special move, which will affect the lifemeter of the player being hit. Many thanks in advance! I love this Phaser engine and the community in this forum. I'm really excited with this game
  3. Change sprite.damage(); behavior

    Hi guys. I was wondering if i can change the sprite.damage() behavior. For example, I want to play the 'die' animation if sprite is dead but if i use damage() as the doc says And the code im using right now squash: function(sprite, pointer){ sprite.damage(this.inputPower); if(!sprite.alive){ sprite.body.velocity.y = 0; sprite.animations.play('die', 2, false, true); }}, So do i have to implement my own method? Thanks