Jump to content

Pick up a ball and attach to player in phaser3


Recommended Posts


I have the code to pick up a ball with the overlay event.

// in the game.js   

 this.physics.add.overlap(this.ballGroup, this.player, this.ballGroup.collectBalls.bind(this.ballGroup));

// in the ballGroup.js

collectBalls (player, ball) {
    if(player.balls >= 3 || ball.active === false) return;
    ball.active = false;
    ball.visible = false;



Now i want to stick the ball/image to the player as a 'weapon'. In other words, how to i attach a sprite to another sprite.

Thanks in advance!




Link to comment
Share on other sites


  • Recently Browsing   0 members

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