MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / jump

Method jump

code/main/QuestEntity.ts:311–325  ·  view source on GitHub ↗
(jumpDuration: number, jumpSpeed: number = 1)

Source from the content-addressed store, hash-verified

309 }
310
311 public jump(jumpDuration: number, jumpSpeed: number = 1): boolean{
312 // BUGS
313 if(Bugs.getQuestBugLevel() >= 2)
314 jumpSpeed = Random.between(1, 5);
315
316 // If we're not already jumping or controlled falling and we would collide by going down (which means we're on the ground), we jump (we also jump without checking all that if we are able to jump in mid-air)
317 if((this.jumping == false && this.controlledFalling == false && this.checkCollision(new Pos(0, 1))) || this.canJumpInMidAir()){
318 this.jumping = true;
319 this.jumpDuration = jumpDuration;
320 this.jumpSpeed = jumpSpeed;
321 return true;
322 }
323
324 return false;
325 }
326
327 public move(pos: Pos, force: boolean = false): boolean{
328 // BUGS

Callers 3

castPlayerJumpMethod · 0.45
jump3Method · 0.45
updateMethod · 0.45

Calls 2

checkCollisionMethod · 0.95
canJumpInMidAirMethod · 0.95

Tested by

no test coverage detected