Jump to content

Simple Question: How to Change size of an image


Recommended Posts

Hi Everyone,


Completely new to Phaser so I am, embarrassingly, having problems even just scaling an image down.


Code looks like this:


var game = new Phaser.Game(
    800, 600, Phaser.AUTO, '', 
    { preload: preload, create: create, update: update });
function preload(){
game.load.image('cat', 'cat.png');
function create(){
 game.stage.backgroundColor = "#8A2BE2";
    game.add.sprite(0,game.world.height-250, 'cat');
function update(){
Could Someone show me how to set the size of the image, cat?
At the moment it is far too big.
Thanks in advance :)



Link to comment
Share on other sites

  • 4 weeks later...
  • 2 years later...

scaleTo works, but I'm using "this.cat.scale.setTo(.05, .05);" which REALLY makes the image pixelated and not good looking. How can I have nice, crip graphics but still kep them small? I'm using texturepacker, but I don't think I can change the size of the images in there... Do I need to shrink the images in spriter and/or illustrator? I bought this spritesheet, but I'm having trouble adding it into my game and having it look good. :/

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.

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.


  • Recently Browsing   0 members

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