Jursdotme

Members
  • Content Count

    4
  • Joined

  • Last visited

About Jursdotme

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you all very much. Hopefully ill get better at spotting Phaser 2 content. I have a feeling i got into this right at a breakingpoint in the migration from 2 to 3. samme's example was almost the perfect fit. All i needed was to make the group a physics group. Here is the final working code: var monsters = this.physics.add.group(); monsters.addMultiple( map.createFromObjects("Monsters", "blob", { key: "monster" }) ); monsters.getChildren().forEach(function(enemy) { // You need to use the `body` methods because these are Sprites (not ArcadeSprites) enemy.body.setBounceX(1); enemy.body.setCollideWorldBounds(true); enemy.body.velocity.x = 40; }, this); this.physics.add.collider(groundLayer, monsters);
  2. The complete project can be found here: https://github.com/Jursdotme/game
  3. So im trying to create enemies in my little starter game (im new to this). I have added my monsters as objects in "Tiled" and do the following: monsters = this.add.group(); monsters.enableBody = true; map.createFromObjects( "Monsters", "blob", { key: "monster" }, 0, true, false, monsters ); monsters.forEach(function(enemy) { enemy.setBounceX(1); enemy.setCollideWorldBounds(true); enemy.body.velocity.x = 40; }, this); However, this fails at the "monsters.forEach()" section. I have seen this done a hundred times all across the web and i have tried any incarnation under the sun. It always fails at this point. Tried solutions with basically the same result: https://thoughts.amphibian.com/2015/12/enemies-that-do-something.html I have been stuck on this for hours. Please help.
  4. Im am having the same problem. Did you find a solution?