Skip to content

How to create tilemap in phaser ? #4

Answered by regisrex
pacifiquem asked this question in Q&A
Discussion options

You must be logged in to vote

A better way and mostly used way to create tilemaps in pixijs is to import Tilemap class from @pixi/tilemap package, and then simple create an instance of the class

 import { Tilemap } from '@pixi/tilemap';
(() => {

 const tilemap = new Tilemap([Texture.from('grass.png').baseTexture])
       .tile('grass.png', 0, 0)
       .tile('grass.png', 100, 100)
       .tile('brick_wall.png', 0, 100);
}())

The code above creates a Tilemap instance and shades it with a texture from the image grass.png.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pacifiquem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants