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

Method constructor

code/main/TheSea.ts:29–58  ·  view source on GitHub ↗
(game: Game)

Source from the content-addressed store, hash-verified

27
28 // Constructor
29 constructor(game: Game){
30 super(game, "You can move with the down and up arrow keys!");
31
32 // Resize the quest
33 this.resizeQuest(100, 30);
34
35 // Add collision boxes around
36 this.addPlayerCollisionBoxes(true, false, true, true);
37
38 // Gravity is disabled
39 this.setGravityDisabled(true);
40 this.setWormsLikeDisabled(true);
41
42 // Add the player
43 this.getGame().getPlayer().loadMediumCharacter(this);
44 this.getGame().getPlayer().setGlobalPosition(new Pos(0, 5));
45 this.configPlayerOrClone(this.getGame().getPlayer());
46 this.addEntity(this.getGame().getPlayer());
47
48 // Fill the floors array with null values
49 for(var i = 0; i <= 99 + this.generationProjection; i++){
50 this.floors.push(null);
51 }
52
53 // Generate for the first time
54 this.generate(0, 99 + this.generationProjection);
55
56 // Add the message
57 this.getGame().getQuestLog().addMessage(new QuestLogMessage("You jump into the sea! You know you could find precious hidden treasures in the depths..."));
58 }
59
60 // willBeDisplayed()
61 public willBeDisplayed(): void{

Callers

nothing calls this directly

Calls 13

configPlayerOrCloneMethod · 0.95
generateMethod · 0.95
resizeQuestMethod · 0.80
setGravityDisabledMethod · 0.80
setWormsLikeDisabledMethod · 0.80
loadMediumCharacterMethod · 0.80
getPlayerMethod · 0.80
setGlobalPositionMethod · 0.80
addEntityMethod · 0.80
addMessageMethod · 0.80
getQuestLogMethod · 0.80

Tested by

no test coverage detected