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

Method getGap

code/main/Quest.ts:717–727  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

715 }
716
717 public getGap(): number{
718 // We find the perfect gap so that the player would be in the center
719 var gap: number = (this.renderArea.getWidth()-100) - (this.getGame().getPlayer().getGlobalPosition().x - 50)*2;
720
721 // We possibly correct this gap to keep the quest in the center if the player is in the left or right of the quest
722 if(gap > (this.renderArea.getWidth()-100)) gap = (this.renderArea.getWidth()-100);
723 if(gap < -(this.renderArea.getWidth()-100)) gap = -(this.renderArea.getWidth()-100);
724
725 // We return the possibly corrected gap
726 return gap;
727 }
728
729 public getGlobalDrawingOffset(): Pos{
730 return this.globalDrawingOffset;

Callers 5

addExitQuestButtonMethod · 0.95
drawPlayerSpellsMethod · 0.95
drawQuestLogMethod · 0.95
drawMethod · 0.45
displayPlaceMethod · 0.45

Calls 4

getGlobalPositionMethod · 0.80
getPlayerMethod · 0.80
getWidthMethod · 0.45
getGameMethod · 0.45

Tested by

no test coverage detected