Jump to content

Phaser class problems


Recommended Posts

I am new to phaser and I am trying to set up a class named "Player". I want to create a group inside the class that contains different sprites that will serve as sensors for collision (hitboxes). Obviously I want the player phyisics to be enabled which I am not beeing able to get it done. I was previously able to enable physics for other sprites that were added the "normal way". Is it because I am using the isometric plugin and this changes somehow?

Also I am have previously tried to set the size of a sprite body but couldn't change its size (at least vissualy when debugging it I saw no difference on the grid) http://udof.org/phaser/iso/doc/Phaser.Plugin.Isometric.Body.html#setSize I am using "setSize(...)" I can change the the last 3 parameters and I see the difference. Not for the first 3 however.

Player = function (game, x, y) {

Phaser.Sprite.call(this, game, x, y, 'player');

    this.scale.x = 1; // this is working
    this.scale.y = 1; // this is too
    game.physics.isoArcade.enable(this); // NOT WORKING
    this.body.collideWorldBounds = true;   


Player.prototype = Object.create(Phaser.Sprite.prototype);
Player.prototype.constructor = Player;


 new_player = new Player(game,size_x/2 + 150,size_y/2 -100);

Any ideas? Thank you

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...