Jump to content

Sprite remove and add to Childs


Recommended Posts

suppose, I have a TileMap and a Button which opens a popup Menu by click.

My popup menu is a sprite (game.add.sprite) which holds some sprites (some Ships) as Child:


My Tilemap is loading by:

map = game.add.tilemap('Map');
map.addTilesetImage('terrain_atlas', 'terrain_atlas');

background = map.createLayer('Background');

How do I get the sprite from the popup menu on the tilemap? I have tried the following.


// Sprite in the popup menu is clicked
function isShipButtonDown(sprite, pointer) {
    sprite.x = 912; // example positions
    sprite.y = 1264;

But the sprite is then no longer visible.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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