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

Method testNewGlobalPosition

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

Source from the content-addressed store, hash-verified

427 }
428
429 public testNewGlobalPosition(pos: Pos): boolean{
430 var oldPosition: Pos = this.globalPosition;
431
432 this.globalPosition = pos;
433
434 // If there's a collision, restore the old position and return false
435 if(this.checkCollision()){
436 this.globalPosition = oldPosition;
437 return false;
438 }
439 // Else, restore the old position and return true
440 this.globalPosition = oldPosition;
441 return true;
442 }
443
444 public update(): void{
445 // We handle berserk mode

Callers 2

updateMethod · 0.80
updateMethod · 0.80

Calls 1

checkCollisionMethod · 0.95

Tested by

no test coverage detected