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

Method moveWormsLike

code/main/QuestEntity.ts:357–377  ·  view source on GitHub ↗
(pos: Pos)

Source from the content-addressed store, hash-verified

355 }
356
357 public moveWormsLike(pos: Pos): boolean{
358 // If we can move normally
359 if(this.checkCollision(pos) == false){
360 // If we can't move two steps below but we can move on step below, then we move one step below (if we're not jumping or controlled falling)
361 if(this.checkCollision(pos.plus(new Pos(0, 2))) == true && this.checkCollision(pos.plus(new Pos(0, 1))) == false && this.jumping == false && this.controlledFalling == false){
362 return this.move(pos.plus(new Pos(0, 1)));
363 }
364 // Else we just move normally
365 else{
366 return this.move(pos);
367 }
368 }
369 // Else, if we can move just one step above (and we're not jumping or controlled falling)
370 else if(this.checkCollision(pos.plus(new Pos(0, -1))) == false && this.jumping == false && this.controlledFalling == false){
371 // We move one step above
372 return this.move(pos.plus(new Pos(0, -1)));
373 }
374
375 // Else we don't move
376 return false;
377 }
378
379 public removeQuestEntityWeapons(): void{
380 this.questEntityWeapons = [];

Callers 1

handleMovementMethod · 0.95

Calls 3

checkCollisionMethod · 0.95
moveMethod · 0.95
plusMethod · 0.80

Tested by

no test coverage detected