Jump to content

Set world bounds for an isometric world


PhasedEvolution
 Share

Recommended Posts

Hello. I am having an hard time on defining the bounds of my isometric world. I have tried so many things but it just doesn't get any good. I couldn't find a way to debug the bounds and actually see them. I think that the setBounds(x, y, width, height) is on screen coordinates. I am not sure anymore? Can someone clarifiy me this and help me ?

EDIT: In the docs of the isometric plugin http://udof.org/phaser/iso/doc/Phaser.Plugin.Isometric.Arcade.html I noticed there is a setbounds for isometric. However I cannot work with it correctly what am I doing wrong? @lewster32 It just bugs the whole thing

game.plugins.add(new Phaser.Plugin.Isometric(game));
game.physics.startSystem(Phaser.Plugin.Isometric.ISOARCADE);
game.time.advancedTiming = true;

game.iso.anchor.set(0.5,0.2);
game.world.setBounds(0, 0, 0, 10000, 10000, 10000);

 

 

 

Link to comment
Share on other sites

The bounds are set by creating a cube:

this.bounds = new Phaser.Plugin.Isometric.Cube(0, 0, 0, game.world.width * 0.5, game.world.width * 0.5, game.world.height);

Then setBounds alters this cube as follows:

    /**
     * Updates the size of this physics world.
     *
     * @method Phaser.Plugin.Isometric.Arcade#setBounds
     * @param {number} x - Bottom rear most corner of the world.
     * @param {number} y - Bottom rear most corner of the world.
     * @param {number} z - Bottom rear most corner of the world.
     * @param {number} widthX - New X width (breadth) of the world. Can never be smaller than the Game.width.
     * @param {number} widthY - New Y width (depth) of the world. Can never be smaller than the Game.width.
     * @param {number} height - New height of the world. Can never be smaller than the Game.height.
     */
    setBounds: function (x, y, z, widthX, widthY, height) {
        this.bounds.setTo(x, y, z, widthX, widthY, height);
    }

However, these are the isometric bounds, which are derived from the world bounds. The key is to set your world bounds in screen space before starting the physics system, and the isometric bounds will be initialised to match the world bounds. You can see an example of this here: http://www.rotates.org/phaser/iso/examples/character_camera_follow.htm

 

Link to comment
Share on other sites

  • 7 months later...

I tested some possibilities and I was able to determine the limits using the code below:


this.game.physics.startSystem(Phaser.Plugin.Isometric.ISOARCADE);
this.game.physics.isoArcade.bounds.widthX = 3 * 32;
this.game.physics.isoArcade.bounds.widthY = 9 * 32;

this.game.iso.anchor.setTo( 0.4, 0.4);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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