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

Method constructor

code/main/Forest.ts:15–40  ·  view source on GitHub ↗
(game: Game)

Source from the content-addressed store, hash-verified

13
14 // Constructor
15 constructor(game: Game){
16 super(game);
17
18 // Resize the quest
19 this.resizeQuest(294, this.groundYPosition + 2);
20
21 // Add collision boxes around
22 this.addPlayerCollisionBoxes(true, false, true, true);
23
24 // Add the player
25 this.getGame().getPlayer().loadCandyBoxCharacter(this);
26 this.getGame().getPlayer().setGlobalPosition(new Pos(0, this.groundYPosition));
27 this.configPlayerOrClone(this.getGame().getPlayer());
28 this.addEntity(this.getGame().getPlayer());
29
30 // Add the ground
31 this.addGround();
32
33 // We add some wolves
34 for(var i = 0; i < 10; i++){
35 this.addWolf(Random.between(80, 280));
36 }
37
38 // Add the message
39 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You enter the forest."));
40 }
41
42 // Public methods
43 public castPlayerTeleport(): void{

Callers

nothing calls this directly

Calls 12

configPlayerOrCloneMethod · 0.95
addGroundMethod · 0.95
addWolfMethod · 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