marein

Members
  • Content Count

    5
  • Joined

  • Last visited

Everything posted by marein

  1. If I understand your code right, you want to check if the player overlap with a spike. You don't want to move the player and the spike physically. If so, replace this: this.game.physics.arcade.collide(this.player, this.spikes, this.playerDie, null, this);With this: this.game.physics.arcade.overlap(this.player, this.spikes, this.playerDie, null, this);This should do the trick. But if you want a bouncing player, please show me the createFromTiledObject function. EDIT: You asked for an explanation for my code. In my games I create a class for each object. There is an example on the phaser site https://phaser.io/examples/v2/sprites/extending-sprite-demo-1.
  2. Hey, you need to set this on each spike object. My previous code is an object oriented way to do that. Maybe you don't use the oop way to achieve that. Can you paste your code that create the spikes? I'm looking forward to extend it. Or maybe this example fit your needs https://phaser.io/examples/v2/arcade-physics/sprite-vs-group. Take a look between line 27 and 37.
  3. Hey AmAuron, you can calling the load method again in the preload function of your state where you need it. This works for me. // Some statepreload: function() { this.audio.load('kalimba', 'assets/audio/kalimba.mp3');}// Some other statepreload:function() { this.audio.load('kalimba', 'assets/audio/newkalimba.mp3');}
  4. Hello frokenstein, I think this example fit your needs https://phaser.io/examples/v2/input/button-open-popup. Take a look at the button object.
  5. Hello Cress, you need to set the spike objects immovable. I do this in the constructor. An example (note: I inject a state, not the entire game): GameObject.Brick = function (state, x, y) { this.state = state; var game = state.game; Phaser.Sprite.call(this, game, x, y, 'texture'); this.frameName = 'some_image_name.png'; state.physics.enable(this, Phaser.Physics.ARCADE); // this line is for you this.body.immovable = true;}; I hope this helps.