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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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