taiko-web/public/src/js/circle.js
KatieFrogs 1db4eb6710 ImportSongs: Add plugin support
- Files with filenames that end with .taikoweb.js can be imported and run to add custom functionality to the game
- The plugin file is a javascript module script that should have a class in the default export
- Currently supported methods in the class: name (string), load, start, stop, unload (functions)
- The class can be extended from the Patch class to add automatic patching of variables and functions
- Here are some of the plugins I made: https://github.com/KatieFrogs/taiko-web-plugins
2022-02-11 17:28:22 +03:00

45 lines
998 B
JavaScript

class Circle{
constructor(...args){
this.init(...args)
}
init(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 || false
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++
}
}
}