phaser-framework Add An Image In Phaser

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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);


Got any phaser-framework Question?