Jump to content

spawns new blocks


VJDev
 Share

Recommended Posts

hi all, here I'm trying to make a stack tower game using Phaser 3, but I'm having a hard time to spwans a new block when the previous block has stopped. please help because I'm still new to studying in Phaser 3.

  Create :

    speed = 4;

    cube = this.add.sprite(300,650, "cGame").setInteractive();;
    cube.setScale(0.2);
    cube.on('pointerdown', function ()
    {
           speed = (speed === 0);

     });
    
    this.time.delayedCall(0, this.startInputEvents, [], this);

 

Update :

cube.x = cube.x + speed;
    
    if (cube.x > 520) {
        speed = -speed;
    }
    else if (cube.x < 80) {
        speed = -speed;
        }

 

Edited by VJDev
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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