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

Method constructor

code/main/Bridge.ts:5–28  ·  view source on GitHub ↗
(game: Game)

Source from the content-addressed store, hash-verified

3class Bridge extends Quest{
4 // Constructor
5 constructor(game: Game){
6 super(game);
7
8 // Resize the quest
9 this.resizeQuest(138, 32);
10
11 // Add collision boxes around
12 this.addPlayerCollisionBoxes(true, false, false, true);
13
14 // Add the player
15 this.getGame().getPlayer().loadCandyBoxCharacter(this);
16 this.getGame().getPlayer().setGlobalPosition(new Pos(0, 17));
17 this.configPlayerOrClone(this.getGame().getPlayer());
18 this.addEntity(this.getGame().getPlayer());
19
20 // Add a wall at the bridge position
21 this.addBridgeFloor();
22
23 // Add the troll
24 this.addTroll();
25
26 // Add the message
27 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You're trying to cross the bridge. A huge troll is blocking your way!"));
28 }
29
30 // Public methods
31 public configPlayerOrClone(entity: QuestEntity): void{

Callers

nothing calls this directly

Calls 12

configPlayerOrCloneMethod · 0.95
addBridgeFloorMethod · 0.95
addTrollMethod · 0.95
resizeQuestMethod · 0.80
loadCandyBoxCharacterMethod · 0.80
getPlayerMethod · 0.80
setGlobalPositionMethod · 0.80
addEntityMethod · 0.80
addMessageMethod · 0.80
getQuestLogMethod · 0.80
getGameMethod · 0.45

Tested by

no test coverage detected