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

Method setGlobalPosition

code/main/QuestEntity.ts:383–396  ·  view source on GitHub ↗
(pos: Pos, force: boolean = false)

Source from the content-addressed store, hash-verified

381 }
382
383 public setGlobalPosition(pos: Pos, force: boolean = false): boolean{
384 var oldPosition: Pos = this.globalPosition;
385
386 this.globalPosition = pos;
387
388 // Check for collisions : restore the old position and return false if the movement would cause a collision
389 if(force == false && this.checkCollision()){
390 this.globalPosition = oldPosition;
391 return false;
392 }
393
394 // Return true
395 return true;
396 }
397
398 public shouldDie(): boolean{
399 // Return true if we are destructible and have 0 hp or we're already dead

Callers 15

moveMethod · 0.95
teleportMethod · 0.95
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80

Calls 1

checkCollisionMethod · 0.95

Tested by

no test coverage detected