FinalFantasyVII

Members
  • Content count

    6
  • Joined

  • Last visited

  1. @samme Good to know! Thanks so much for the explanation! 。^‿^。
  2. Hi! Try this: //Create collision level2.physics.arcade.overlap(ground, emails, fbiCollect, null, this); //enemy collect function enemy(ground, mail) { console.log('in enemy collect'); mail.kill(); scoreEnemy += 10; } I hope it helps!
  3. Hi! Try this: Create 4 lives (three hearts and the player): Declare variables: this.livesCounter = 4; this.lives = null; On create function: // Lives this.lives = this.add.group(); var x = 100; // use your values var y = 100; for (var i = 0; i < 3; i++) { var yourSprite = this.lives.create( x - 100 + 30 * i, y, 'sprite' ); yourSprite.anchor.setTo(0.5, 0.5); } Callback: // Callback hurtPlayer: function(player, enemy) { console.log(this.hitCounter); //do this during overlap this.isHit = true; this.canShoot = false; enemy.play('attacking'); player.play('hit'); var live; live = this.lives.getFirstAlive(); if (live) { live.kill(); } this.livesCounter--; if (this.livesCounter == 0) { player.kill(); this.playerDies(); // Use your custom function when the player dies } }, I hope it helps!!!
  4. Hi! Try this: spawnEnemies: function(map){ this.enemies = this.game.add.group(); this.game.physics.arcade.enable(this.enemies); var enemyStartPositions = this.findObjectsByType('enemyStart', this.map, 'objectLayer'); for(var i = 0; i < enemyStartPositions.length; i++){ var enemyStart = enemyStartPositions[i]; var enemy = new Enemy(this.game, enemyStart.x, enemyStart.y, 'cultist'); enemy.countStats(); this.enemies.add(enemy); } this.enemies.setAll("body.immovable", true); } this.physics.arcade.collide(this.enemies); this.physics.arcade.collide( this.player, this.enemies, this.collisionHandlerPlayerAndEnemy, null, this ); this.physics.arcade.collide( this.enemies, null, this.collisionHandlerEnemyAndEnemy, null, this ); Check your 'map' argument 'function(map)' and 'this.map'. Is 'this.map' a variable? If you want to make it a returning argument just write 'map' I hope it helps!
  5. Hi! Try this. To see the size of the collision rectangle. render: function () { this.game.debug.body(this.sprite); } Then adjust the size of the collision rectangle create: function () { this.sprite.body.setSize(16, 10); // Set your collision size }
  6. Hi! Try this: update: function () { game.physics.arcade.collide(this.player, this.floor); game.physics.arcade.overlap(this.weapon.bullets, this.enemies, this.hitEnemy, null, this); }