• Content count

  • Joined

  • Last visited

  1. Remove tile for collect coins

    Up topic
  2. Remove tile for collect coins

    Hello I want to collect coins in my platformer game, so i need to remove coin tile when my player overpap it. So, in create function i add this map.setTileIndexCallback(50, this.collectCoin, this); And create new collectCoin method map.putTile(-1, layer.getTileX(player.x), layer.getTileY(player.y)); score += 10; And thats work, but the number of points is accumulated too much, when the player is standing next to the coin itself, it does not disappear, and points are scored at a high speed I try to use new TilemapLayer , but its causes an error alpha = 0 now work or I am doing something wrong
  3. Hello everybody. Need your help with Tiled Map Editor. I had a set of tiles, I updated it with another one in which there is a new tile, but when I add it to the map, another one is displayed instead, and so with some tiles. tried all tiles and a new one was not found Who faced the similar? how to fix the problem?
  4. Uncaught TypeError in my first app.

    thank you, rescued!
  5. Hello everybody I write my first application, add physics for my player, add cursors , input keyboards. En error you will see on the screenshots. var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameDiv'); var spacefield; var backgroundv; var player; var cursors; var mainState = { preload: function(){ game.load.image('starfield', "assets/starfield.png"); game.load.image('player', "assets/player.png"); }, create: function(){ spacefield = game.add.tileSprite(0, 0, 800, 600, 'starfield'); backgroundv = 5; game.add.sprite(game.world.centerX, game.world.centerY + 200, 'player'); game.physics.enable(player, Phaser.Physics.ARCADE); cursors = game.input.keyboard.createCursorKeys(); }, update: function(){ spacefield.tilePosition.y += backgroundv; if(cursors.left.isDown){ player.body.velocity.x = -350; } if(cursors.right.isDown){ player.body.velocity.x = 350; } } }; game.state.add('mainState', mainState); game.state.start('mainState'); Whats wrong?