Jump to content

How to add custom property to Sprite object?


Recommended Posts

I want to add custom property to my sprite object but when I try to get id property it returns "undefined".

Is there a Phaser library bug or am I doing something wrong?

My update function;

function update() {
    //When I debug below line I can see enemyTank.tank.id property
    game.physics.arcade.overlap(enemyTank.tank, mytank.tank, enemyTankHitPlayer, null, this);

Callback function;

function enemyTankHitPlayer(myTankSprite, enemyTankSprite) {
    //enemyTankSprite.id is undefined!


Link to comment
Share on other sites


  • Recently Browsing   0 members

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