phaser-framework Add An Image In Phaser


Introduction

Adding an image file (preferable a png) to your game as an "Image" object in Phaser.

Syntax

  • game.load.image( name:string, file:string,);
  • game.add.image( x:number, y:number, name:string);

Remarks

  • An Image object is a good choice for things in your game that don't use frame animations and don't otherwise need to be a Sprite.
  • By default the anchor point for an image in the upper left corner, but you can change it like this: image.anchor.setTo(0.5, 0.5);