1 decade ago by tyler
I wanted a entity to match its position to background layer that had a distance of 1.16. It looks like theres no official way to do this so I hacked this quickly. I just override the draw method with this:
Its not perfect, but its as close as I can get. Im sure there is a better way, I just dont know what it is.
draw: function() { if( this.currentAnim ) { this.currentAnim.draw( (Math.round(this.pos.x) - this.offset.x - ig.game.screen.x)/this.distance, (Math.round(this.pos.y) - this.offset.y - ig.game.screen.y)/this.distance ); } }
Its not perfect, but its as close as I can get. Im sure there is a better way, I just dont know what it is.