MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / Player

Class Player

Player.js:138–1302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138class Player {
139
140
141 constructor() {
142 this.width = 50;
143 this.height = 65;
144
145 // this.currentPos = createVector(width / 2, height - 200); // this is the top left corner of the hitbox
146 this.currentPos = createVector(width / 2, height - 200); // this is the top left corner of the hitbox
147 this.currentSpeed = createVector(0, 0);
148 this.isOnGround = false;
149
150 this.jumpHeld = false;
151 this.jumpTimer = 0;
152 this.leftHeld = false;
153 this.rightHeld = false;
154
155
156 this.facingRight = true;
157 this.hasBumped = false;
158 this.isRunning = false;
159 this.isSlidding = false;
160 this.currentRunIndex = 1;
161 this.runCycle = [run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run1Image, run2Image, run2Image, run2Image, run2Image, run2Image, run2Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run3Image, run2Image, run2Image, run2Image, run2Image, run2Image, run2Image]
162 this.sliddingRight = false;
163
164 // this.currentLevel = null;
165 this.currentLevelNo = 0;
166
167 this.jumpStartingHeight = 0;
168 this.hasFallen = false;
169
170 this.blizzardForce = 0;
171 this.blizzardForceAccelerationDirection = 1;
172 this.maxBlizzardForceTimer = 0;
173 this.snowImagePosition = 0;
174
175
176 // ai shit
177 this.aiActionTimer = 0;
178 this.aiActionMaxTime = 0;
179 this.isWaitingToStartAction = false;
180 this.actionStarted = false;
181 this.brain = new Brain(startingPlayerActions);
182 this.currentAction = null;
183
184 this.playersDead = false;
185
186
187 this.previousSpeed = createVector(0, 0);
188
189
190 this.bestHeightReached = 0;
191 this.bestLevelReached = 0;
192 this.reachedHeightAtStepNo = 0;
193 this.bestLevelReachedOnActionNo = 0;
194 //
195 // this.jumpSound = loadSound('sounds/jump.mp3')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected