2018-09-15 16:34:53 +02:00
|
|
|
class Circle{
|
2022-02-11 15:28:22 +01:00
|
|
|
constructor(...args){
|
|
|
|
this.init(...args)
|
|
|
|
}
|
|
|
|
init(config){
|
2018-09-20 01:20:26 +02:00
|
|
|
this.id = config.id
|
|
|
|
this.ms = config.start
|
2018-10-14 20:08:05 +02:00
|
|
|
this.originalMS = this.ms
|
2018-09-20 01:20:26 +02:00
|
|
|
this.type = config.type
|
|
|
|
this.text = config.txt
|
|
|
|
this.speed = config.speed
|
2018-09-21 22:31:35 +02:00
|
|
|
this.endTime = config.endTime || this.ms
|
2018-10-14 20:08:05 +02:00
|
|
|
this.originalEndTime = this.endTime
|
2018-09-18 19:33:18 +02:00
|
|
|
this.isPlayed = 0
|
2018-09-15 16:34:53 +02:00
|
|
|
this.animating = false
|
|
|
|
this.animT = 0
|
|
|
|
this.score = 0
|
2018-09-20 01:20:26 +02:00
|
|
|
this.lastFrame = this.ms + 100
|
2018-09-15 16:34:53 +02:00
|
|
|
this.animationEnded = false
|
|
|
|
this.timesHit = 0
|
2018-11-13 05:36:15 +01:00
|
|
|
this.timesKa = 0
|
2018-09-20 01:20:26 +02:00
|
|
|
this.requiredHits = config.requiredHits || 0
|
2018-09-18 19:33:18 +02:00
|
|
|
this.rendaPlayed = false
|
2020-03-12 05:59:28 +01:00
|
|
|
this.gogoTime = config.gogoTime || false
|
2018-09-20 01:20:26 +02:00
|
|
|
this.gogoChecked = false
|
2018-10-11 22:24:18 +02:00
|
|
|
this.beatMS = config.beatMS
|
2019-01-26 19:29:13 +01:00
|
|
|
this.fixedPos = config.fixedPos
|
2019-02-17 17:26:46 +01:00
|
|
|
this.branch = config.branch
|
|
|
|
this.section = config.section
|
2018-09-15 16:34:53 +02:00
|
|
|
}
|
2018-10-07 20:58:42 +02:00
|
|
|
animate(ms){
|
2018-09-15 16:34:53 +02:00
|
|
|
this.animating = true
|
2018-10-07 20:58:42 +02:00
|
|
|
this.animT = ms
|
2018-09-15 16:34:53 +02:00
|
|
|
}
|
2018-09-18 19:33:18 +02:00
|
|
|
played(score, big){
|
2018-09-15 16:34:53 +02:00
|
|
|
this.score = score
|
2018-09-21 22:31:35 +02:00
|
|
|
this.isPlayed = score <= 0 ? score - 1 : (big ? 2 : 1)
|
2018-09-15 16:34:53 +02:00
|
|
|
}
|
2018-11-13 05:36:15 +01:00
|
|
|
hit(keysKa){
|
2018-09-15 16:34:53 +02:00
|
|
|
this.timesHit++
|
2018-11-13 05:36:15 +01:00
|
|
|
if(keysKa){
|
|
|
|
this.timesKa++
|
|
|
|
}
|
2018-09-15 16:34:53 +02:00
|
|
|
}
|
2015-07-17 10:22:46 +02:00
|
|
|
}
|