| 1 | class AIAction { |
| 2 | constructor(isJump, holdTime, xDirection) { |
| 3 | this.isJump = isJump; |
| 4 | this.holdTime = holdTime;//number between 0 and 1 |
| 5 | this.xDirection = xDirection; |
| 6 | |
| 7 | } |
| 8 | |
| 9 | clone() { |
| 10 | return new AIAction(this.isJump, this.holdTime, this.xDirection); |
| 11 | } |
| 12 | |
| 13 | mutate() { |
| 14 | this.holdTime += random(-0.3,0.3); |
| 15 | this.holdTime = constrain(this.holdTime,0.1,1); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | |
| 20 | // let jumpChance = 0; //the chance that a random action is a jump |
nothing calls this directly
no outgoing calls
no test coverage detected