Jump to content

Global to Local


Recommended Posts

Hi there, trying to convert global particle shooting sprite coordinates to local value to attach them later for my space ship. Wana use this coordinates to simulate hit effect (sprite animation) which will be attached to ship with addChild. Tho have problems, seems toLocal and toGlobal doesn't work for some reason... using Phaser CE, it should be fine there, tho when i searched for examples, almost nothing at all, only using in groups and what about situations when y just have some random sprite?

collide(entity) {
        let x = entity.toLocal(this.body.pivot, this.body.sprite);
        let y = entity.toLocal(this.body.pivot, this.body.sprite);
        let effect = this.addChild(this.game.make.sprite(x, y, 'hit'));

This = player class


Link to comment
Share on other sites


  • Recently Browsing   0 members

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