Jump to content

replace tile wont work


nak3ddogs
 Share

Recommended Posts

Hi! i wanna make background animation and i thinked i will use the map.replace(x1,x2) method with a timer.

 

but the example wont work for me when i download and try on my pc. what can be the problem?

pls help

 

   <script type="text/javascript">var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update});function preload() {      game.load.tilemap('pina', 'assets/proba.json', null, Phaser.Tilemap.TILED_JSON);          game.load.image('levelPng', 'assets/tile.png');}var map;var layer;function create() {    game.physics.startSystem(Phaser.Physics.ARCADE);    map = game.add.tilemap('pina');    map.addTilesetImage('tile','levelPng');    layer1 = map.createLayer('Tile Layer 1');    cursors = game.input.keyboard.createCursorKeys();    game.input.onDown.addOnce(replaceTiles, this);}function replaceTiles() {    map.replace(1, 2);    map.replace(3, 4);    map.replace(5, 6);}function update() {  }  </script>
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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