Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
j-weissen 2023-01-17 08:13:19 +01:00
commit 4f936aaa42
2 changed files with 24 additions and 4 deletions

View file

@ -206,8 +206,7 @@ function keyPressed() {
if (!ready) return; if (!ready) return;
// Jump // Jump
if (BOOST_KEYS.includes(key.toLowerCase())) { if (BOOST_KEYS.includes(key.toLowerCase())) {
resetScore(); playerInput();
raspberry.boost();
} }
// Pause the Game // Pause the Game
@ -217,3 +216,24 @@ function keyPressed() {
paused = false; paused = false;
} }
} }
/**
* Mouse clicked event.
*/
function mouseClicked() {
if (!ready) return;
if (paused) {
paused = false;
}
playerInput();
}
/**
* Handles input for the player, when a key is pressed, or the mouse is clicked.
*/
function playerInput() {
resetScore();
raspberry.boost();
}

View file

@ -36,7 +36,7 @@ class Raspberry extends Entity {
* Maximum velocity, so the raspberry doesn't get to infinite speed when boosting. * Maximum velocity, so the raspberry doesn't get to infinite speed when boosting.
* @private * @private
*/ */
private static readonly maxVelocity: number = 100; private static readonly maxVelocity: number = 75;
/** /**
* Width. * Width.
@ -70,7 +70,7 @@ class Raspberry extends Entity {
* @param value * @param value
*/ */
set velocity(value: number) { set velocity(value: number) {
this._velocity = (Math.abs(this.velocity) > Raspberry.maxVelocity) ? Raspberry.maxVelocity : value; this._velocity = (Math.abs(this.velocity) > Raspberry.maxVelocity) ? -Raspberry.maxVelocity : value;
} }
/** /**