japanese-drum-game/public/src/js/circle.js
LoveEevee 03b9326733 PraseTja: Add branches
- Needs the following changes to the database: change `easy`, `normal`, `hard`, and `oni` to `TEXT` type
- When adding songs to the database and if, for example, a song's 7-star difficulty has a branch, instead of `7` input `7 B`, this is to display song's branch support on the song selection
- Branch can be forced in debug
2019-02-17 19:26:46 +03:00

42 lines
949 B
JavaScript

class Circle{
constructor(config){
this.id = config.id
this.ms = config.start
this.originalMS = this.ms
this.type = config.type
this.text = config.txt
this.speed = config.speed
this.endTime = config.endTime || this.ms
this.originalEndTime = this.endTime
this.isPlayed = 0
this.animating = false
this.animT = 0
this.score = 0
this.lastFrame = this.ms + 100
this.animationEnded = false
this.timesHit = 0
this.timesKa = 0
this.requiredHits = config.requiredHits || 0
this.rendaPlayed = false
this.gogoTime = config.gogoTime
this.gogoChecked = false
this.beatMS = config.beatMS
this.fixedPos = config.fixedPos
this.branch = config.branch
this.section = config.section
}
animate(ms){
this.animating = true
this.animT = ms
}
played(score, big){
this.score = score
this.isPlayed = score <= 0 ? score - 1 : (big ? 2 : 1)
}
hit(keysKa){
this.timesHit++
if(keysKa){
this.timesKa++
}
}
}