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

Method constructor

code/main/Quest.ts:47–84  ·  view source on GitHub ↗
(game: Game, specialInstruction: string = null)

Source from the content-addressed store, hash-verified

45
46 // Constructor
47 constructor(game: Game, specialInstruction: string = null){
48 super(game);
49
50 // Set the special instruction
51 this.specialInstruction = specialInstruction;
52
53 // Reset the player
54 this.getGame().resetPlayer();
55
56 // Create player spells
57 this.createPlayerSpells();
58
59 // Set the real quest position
60 this.realQuestPosition = new Pos(0, 2);
61
62 // And the size to add to the real quest size
63 this.sizeToAddToTheRealQuestSize = new Pos(0, 12);
64
65 // If there is a special instruction, change the real quest position
66 if(this.specialInstruction != null){
67 this.realQuestPosition.add(new Pos(0, 1));
68 }
69
70 // If there is at least a spell, change the real quest position
71 if(this.playerSpells.length != 0){
72 this.realQuestPosition.add(new Pos(0, this.playerSpellsHeight));
73 }
74
75 // Add two delimiters in the quest log
76 this.getGame().getQuestLog().addDelimiter();
77
78 // Create the player collision boxes entity
79 this.playerCollisionBoxes = new Wall(this, new Pos(0, 0));
80
81 // Set the quest slowed down variable at the game level (and the quest speed up too)
82 this.getGame().setQuestSlowedDown(false);
83 this.getGame().setQuestSpeedUp(0);
84 }
85
86 // Public methods
87 public addPlayerCollisionBoxes(top: boolean, right: boolean, bottom: boolean, left: boolean): void{

Callers

nothing calls this directly

Calls 8

createPlayerSpellsMethod · 0.95
resetPlayerMethod · 0.80
addDelimiterMethod · 0.80
getQuestLogMethod · 0.80
setQuestSlowedDownMethod · 0.80
setQuestSpeedUpMethod · 0.80
addMethod · 0.65
getGameMethod · 0.45

Tested by

no test coverage detected