Git Product home page Git Product logo

Comments (6)

dud3 avatar dud3 commented on June 18, 2024

Ping.

from phaser-plugin-isometric.

dud3 avatar dud3 commented on June 18, 2024

@lewster32 what if we rotate the tile so that'll be parallel to the isometric axes?

from phaser-plugin-isometric.

lewster32 avatar lewster32 commented on June 18, 2024

Sorry for the delay - yes, you cannot rotate bodies as their edges must be aligned to the isometric axes. Rotating doesn't really make a lot of sense in an isometric scene as due to the sprites being 3D representations, any rotations would typically have to be entirely redrawn (i.e. entirely different frames, rather than just transformations to an existing frame). I don't think I'm entirely understanding what you're trying to achieve, so if you have an example then I can try to be more specific, and maybe suggest workarounds.

from phaser-plugin-isometric.

dud3 avatar dud3 commented on June 18, 2024

@lewster32 Sorry for my late reply as well, the following is what I'm trying to achieve:

countrylife-001
countrylife-002

BTW: sorry, it's not a usual rotation, we're not using any trig functions, simply flipping x and y axis.

Guessing the following does the flipping transformation y=x, after applying it the bouds don't get recalculated.

var cow = game.add.isoSprite(100, 100, 0, 'animal-cow-brown', 0);
cow.width *= -1;

How do we calculate the bound of an object?
What about the height of an isometric object?

I think there must be something wrong with the bounds calculation, they don't seem accurate.

from phaser-plugin-isometric.

lewster32 avatar lewster32 commented on June 18, 2024

Does flipping the scale not work? That is how I'd normally do this in Phaser.
cow.scale.x *= -1

from phaser-plugin-isometric.

lewster32 avatar lewster32 commented on June 18, 2024

Appears not - the issue seems to be that bounds are initially derived from the sprite size and assumed to be cubic. When changing the scale or width, any non-cubic bounds are not then automatically updated. I guess the workaround is to manually update the bounds yourself when changing the orientation of the sprite, as there is naturally a looser orientation between the sprite and its body with an isometric system; it has to assume some basic things about the sprite, as it cannot interpret any orientation or shape other than the cubic bounds it should occupy for its size.

In order to set your own bounds, you would use cow.body.setSize as documented here.

from phaser-plugin-isometric.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.