How do I make the mouse do a "dash" and "Slam" move on a game that uses WASD?

Hello! I’m super new to Phaser 3, and I’m trying to figure out how to use the cursor to include “slam” and “dash” like moves for a game that primarily uses WASD for player movement.

For example, the player sees an enemy during a level run and chooses to ram into it using a dash move, like how Kirby/Sonic does. How do I integrate the mouse buttons for the dash/slam moves while still using WASD? I’m guessing it’s a different function, but I don’t know how to do it.

(I’m also learning how to game code, and I yearn to make more games in the future. All and any help is greatly appreciated. Please + Thank you, MT )

Something like this:

create() {
    // Create movement keys
    this.keys = this.input.keyboard.addKeys({
        w: Phaser.Input.Keyboard.KeyCodes.W,
        a: Phaser.Input.Keyboard.KeyCodes.A,
        s: Phaser.Input.Keyboard.KeyCodes.S,
        d: Phaser.Input.Keyboard.KeyCodes.D
    });

    this.input.on('pointerdown', (pointer) => {
        const direction = this.getHeldDirection();

        if (!direction) {
            return;
        }

        this.doDirectionalMove(direction, pointer);
    });
}

getHeldDirection() {
    if (this.keys.w.isDown) {
        return 'up';
    }

    if (this.keys.s.isDown) {
        return 'down';
    }

    if (this.keys.a.isDown) {
        return 'left';
    }

    if (this.keys.d.isDown) {
        return 'right';
    }

    return null;
}

doDirectionalMove(direction, pointer) {
    switch (direction) {
        case 'up':
            console.log('Do upward mouse move');
            break;

        case 'down':
            console.log('Do downward mouse move');
            break;

        case 'left':
            console.log('Do left mouse move');
            break;

        case 'right':
            console.log('Do right mouse move');
            break;
    }
}

There are a lot of pointer properties and methods you can use:

https://codepen.io/samme/pen/raWaVwq?editors=0010