Jump to content

tween: appear and disappear


giorg
 Share

Recommended Posts

hi,

I'm doing this which works perfectly:

let man = this.add.image(-416, 128, this.man).setOrigin(0, 0);
        this.tweens.add({
            targets: man,
            x: 0,
            duration: 2000,
            ease: 'Power1'
        });

to show a picture coming out from left side of the screen. Now I need, after a while to make the opposite, so trying:

this.time.delayedCall(2500, () => {
            this.tweens.add({
                target: man,
                x: -416,
                duration: 2000,
                ease: 'Power1'
            });
        }, this);

but I'm getting this in console:

Uncaught TypeError: Cannot read property 'length' of null

the error is on the add method. What am I doing wrong?

Thanks a lot

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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