Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Rotate when keydown


Recommended Posts

Hello everyone. I'm knew here and also knew to Phaser 3. I'm working on a game currently where you play as a lost ball who is trying to make it back to his owner. Anyway, I have my player movement working fine. I but when I keypress "w" or "a" I want the ball to also continuously rotate (to look like it's rolling) while those buttons are held down. this.ball.setRotation() will only rotate the ball once. I've done a lot of digging and can't seem to find what I'm looking for.


update() {
        // Movement (left/right)
        if (this.cursors.left.isDown) {
          } else if (this.cursors.right.isDown) {
          } else {
        // Jumping mechanic
        if (this.cursors.jump.isDown && this.ball.body.touching.down) {


Link to comment
Share on other sites


  • Recently Browsing   0 members

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