Jump to content

Proper way to scale assets for the whole game?


Poe
 Share

Recommended Posts

I feel like I might be missing something, but so far the only way I have found is by using zoom in the game config. However I am struggling to figure out how the zoom affects other aspects of the game.

I made this function 

    adjustCamera() {
        if(this.floor.width*this.sys.game.config.zoom > window.innerWidth || this.floor.height*this.sys.game.config.zoom > window.innerHeight) { 
            this.cameras.main.startFollow(this.player) 
            console.log('Following Player')
        } else { 
            this.cameras.main.centerOn((this.floor.width/2)*this.sys.game.config.zoom, (this.floor.height/2)*this.sys.game.config.zoom) 
            this.cameras.main.setBounds(this.floor.x, this.floor.y, (this.floor.width/this.sys.game.config.zoom)*2, (this.floor.height/this.sys.game.config.zoom)*2)
            console.log('Centered on map.)
        } 
    }

But camera doesn't seem to follow my player, so I might just be approaching this incorrectly (Maybe I just need to scale each asset individually?).. pretty new to game dev and phaser so please forgive me! 

Any help would be appreciated!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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