This page is work-in-progress. You can reach me on twitter or mail to rezoner1337@gmail.com

Playground - Images

Loading images in playground is as simple as

this.loadImages("one", "two", "three");

It will search for into images/one.png, images/two.png, images/three.png

Then you can use the image like

this.layer.drawImage(this.images.one, 0, 0);

Folders

You can use folders to group your images.

this.loadImages(
  "units/tank", 
  "units/soldier",
  ...
);

It will search for images into images/units/tank.png, images/units/soldier.png, ...

Then you can use the image like

this.images["units/tank"];
this.images["units/soldier"];
...

or

this.images.units.tank
this.images.units.soldier
...

Default extension

Playground defaults to .png but you can override it:

this.loadImages("background.jpg");

And still use it like:

this.images.background;

Caveat is that you cannot have background.png and background.jpg at the same time.

Ask question:

Fork me on GitHub