| 17 | let mutePlayers = true; |
| 18 | |
| 19 | class PlayerState { |
| 20 | constructor() { |
| 21 | this.currentPos = createVector(width / 2, height - 200); // this is the top left corner of the hitbox |
| 22 | this.currentSpeed = createVector(0, 0); |
| 23 | this.isOnGround = false; |
| 24 | |
| 25 | |
| 26 | this.blizzardForce = 0; |
| 27 | this.blizzardForceAccelerationDirection = 1; |
| 28 | this.maxBlizzardForceTimer = 0; |
| 29 | this.snowImagePosition = 0; |
| 30 | |
| 31 | |
| 32 | this.bestHeightReached = 0; |
| 33 | this.bestLevelReached = 0; |
| 34 | this.reachedHeightAtStepNo = 0; |
| 35 | this.bestLevelReachedOnActionNo = 0; |
| 36 | |
| 37 | this.brainActionNumber = 0 |
| 38 | |
| 39 | this.currentLevelNo = 0; |
| 40 | this.jumpStartingHeight = 0; |
| 41 | this.facingRight = true; |
| 42 | |
| 43 | |
| 44 | this.isWaitingToStartAction = false; |
| 45 | this.actionStarted = false; |
| 46 | |
| 47 | } |
| 48 | |
| 49 | getStateFromPlayer(player) { |
| 50 | this.currentPos = player.currentPos.copy(); |
| 51 | this.currentSpeed = player.currentSpeed.copy(); |
| 52 | this.isOnGround = player.isOnGround |
| 53 | |
| 54 | |
| 55 | this.blizzardForce = player.blizzardForce; |
| 56 | this.blizzardForceAccelerationDirection = player.blizzardForceAccelerationDirection; |
| 57 | this.maxBlizzardForceTimer = player.maxBlizzardForceTimer; |
| 58 | this.snowImagePosition = player.snowImagePosition; |
| 59 | |
| 60 | |
| 61 | this.bestHeightReached = player.bestHeightReached; |
| 62 | this.bestLevelReached = player.bestLevelReached; |
| 63 | this.reachedHeightAtStepNo = player.reachedHeightAtStepNo; |
| 64 | this.bestLevelReachedOnActionNo = player.bestLevelReachedOnActionNo; |
| 65 | this.brainActionNumber = player.brain.currentInstructionNumber; |
| 66 | |
| 67 | this.currentLevelNo = player.currentLevelNo; |
| 68 | this.jumpStartingHeight = player.jumpStartingHeight; |
| 69 | this.facingRight = player.facingRight; |
| 70 | |
| 71 | this.isWaitingToStartAction = player.isWaitingToStartAction; |
| 72 | this.actionStarted = player.actionStarted; |
| 73 | } |
| 74 | |
| 75 | loadStateToPlayer(player) { |
| 76 | player.currentPos = this.currentPos.copy(); |
nothing calls this directly
no outgoing calls
no test coverage detected