Fix goal calulcation
This commit is contained in:
parent
85dd6cf45f
commit
5d3856f95a
@ -2,6 +2,8 @@ import { canvas, ctx } from './canvas'
|
||||
import { Level, Rock, Gold, Diamond, Lootbag } from './level'
|
||||
import { randomi } from './utils'
|
||||
|
||||
const MAP_CLEARANCE_PERCENTAGE = 80
|
||||
|
||||
const REWARD_TABLE = {
|
||||
rock: 16,
|
||||
gold: [129, 543, 2399],
|
||||
@ -16,6 +18,7 @@ export class Game {
|
||||
this.roundTime = time
|
||||
this.time = time
|
||||
this.score = 0
|
||||
this.lastGoal = 0
|
||||
this.goal = 0
|
||||
|
||||
this.level = null
|
||||
@ -68,7 +71,8 @@ export class Game {
|
||||
this.currentLevel++
|
||||
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.lastGoal = this.goal
|
||||
this.goal = Math.floor(this.lastGoal + Game.calculateLevelScore(this.level) * (MAP_CLEARANCE_PERCENTAGE / 100))
|
||||
this.player.hook.clear()
|
||||
}
|
||||
|
||||
@ -142,6 +146,7 @@ export class Game {
|
||||
setTimeout(() => {
|
||||
this.currentLevel = 0
|
||||
this.score = 0
|
||||
this.lastGoal = 0
|
||||
this.nextLevel()
|
||||
this.state = 0
|
||||
}, 500)
|
||||
|
Loading…
Reference in New Issue
Block a user