Jump to content

Search the Community

Showing results for tags 'without move'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi It's my first post here, glad to join you guys. Anyway I try to flip sprite(or just texture) horizontally, these are the only ways I found: sprite.scale.x = -1;or sprite.width = sprite.width * -1;but both of them are buggy ways (I don't mean that scalling has a bug). They of course flip sprite horizontally, but also move it to the left of sprite.width pixels. I don't really like the solution that we could keep state for example: sprite.flippedH = true; //user defined variable; so then we can move it to the right preventing displacement of sprite. Is there something to just flip it without changing displaying position? EDIT: Is this the only way we can do it? //extending PIXI.Sprite classPIXI.Sprite.prototype.__defineGetter__("flippedH", function() { return (this._flippedH === true);});PIXI.Sprite.prototype.__defineSetter__("flippedH", function(val) { if ( val != (this._flippedH===true) ) { if ( val ) { this.anchor.x = 0.9; //not 1, because then 1px is out of place to right side } else { this.anchor.x = 0; } this.scale.x *= -1; } this._flippedH = val;});it uses scale and anchor vars, Why it's bad way to achieve it? Because when we use anchor or scalling things to do something different that this, we need to care about negative value of scale and occupied field of anchor. Any ideas?
×
×
  • Create New...