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

Method constructor

code/main/Desert.ts:9–66  ·  view source on GitHub ↗
(game: Game)

Source from the content-addressed store, hash-verified

7
8 // Constructor
9 constructor(game: Game){
10 super(game);
11
12 // Resize the quest
13 this.resizeQuest(149, 30);
14
15 // Add collision boxes around
16 this.addPlayerCollisionBoxes(true, false, true, true);
17
18 // Add the player
19 this.getGame().getPlayer().loadCandyBoxCharacter(this);
20 this.getGame().getPlayer().setGlobalPosition(new Pos(0, 26));
21 this.configPlayerOrClone(this.getGame().getPlayer());
22 this.addEntity(this.getGame().getPlayer());
23
24 // Add the ground
25 this.addGround(
26 0, 3, 1, // From x = 0 to x = 3, the ground will start at y = 1
27 4, 12, 0, // From x = 4 to x = 12, the ground will start at y = 0
28 13, 18, 1, // Etc
29 19, 24, 2,
30 25, 30, 3,
31 31, 36, 2,
32 37, 42, 1,
33 43, 51, 0,
34 52, 57, 1,
35 58, 62, 2,
36 63, 68, 3,
37 69, 75, 2,
38 76, 82, 1,
39 83, 92, 0,
40 93, 97, 1,
41 98, 101, 2,
42 102, 107, 3,
43 108, 113, 2,
44 114, 119, 1,
45 120, 128, 0,
46 129, 134, 1,
47 135, 139, 2,
48 140, 145, 3,
49 146, 148, 2
50 );
51
52 // Bird adding stuff
53 this.currentBirdTime = 0;
54 this.setNextBirdAt();
55
56 // Add the camels
57 this.addCamel(new Pos(44, 24));
58 this.addCamel(new Pos(65, 26));
59 this.addCamel(new Pos(84, 24));
60 this.addCamel(new Pos(106, 26));
61 this.addCamel(new Pos(118, 24));
62 this.addCamel(new Pos(144, 26));
63
64 // Add the message
65 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You enter the desert, camels and palm trees as far as the eye can see."));
66 }

Callers

nothing calls this directly

Calls 13

configPlayerOrCloneMethod · 0.95
addGroundMethod · 0.95
setNextBirdAtMethod · 0.95
addCamelMethod · 0.95
resizeQuestMethod · 0.80
loadCandyBoxCharacterMethod · 0.80
getPlayerMethod · 0.80
setGlobalPositionMethod · 0.80
addEntityMethod · 0.80
addMessageMethod · 0.80
getQuestLogMethod · 0.80

Tested by

no test coverage detected