Clear the hook on new level

This commit is contained in:
Evert Prants 2019-11-29 19:56:07 +02:00
parent 25455273ed
commit c9c1e9c4c4
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 9 additions and 0 deletions

View File

@ -69,6 +69,7 @@ export class Game {
this.time = this.roundTime
this.level = Level.create(this.currentLevel, this.oh, this.gw, this.gh)
this.goal = Math.floor(this.score / 2 + Game.calculateLevelScore(this.level) * 0.65)
this.player.hook.clear()
}
displayMessage (msg, time = 60) {

View File

@ -50,6 +50,14 @@ class Hook extends GameObject {
ctx.restore()
}
clear () {
this.obj = null
this.d = 0
this.md = -1
this.x = this.rx
this.y = this.ry
}
update (level) {
if (this.d === 0 && this.r < FULL_ROTATION_EDGE && this.rd === 1) {
this.r += 1