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

Method constructor

code/main/JellyFish.ts:5–33  ·  view source on GitHub ↗
(quest: Quest, pos: Pos)

Source from the content-addressed store, hash-verified

3class JellyFish extends QuestEntity{
4 // Constructor
5 constructor(quest: Quest, pos: Pos){
6 super(quest,
7 pos,
8 new Naming("A jellyfish", "a jellyfish"),
9 new RenderArea(6, 5),
10 new Pos(0, 0),
11 new CollisionBoxCollection(new CollisionBox(this, new Pos(0, 1), new Pos(6, 1)),
12 new CollisionBox(this, new Pos(1, 2), new Pos(4, 1)),
13 new CollisionBox(this, new Pos(0, 3), new Pos(4, 1)),
14 new CollisionBox(this, new Pos(1, 4), new Pos(4, 1))
15 ),
16 new QuestEntityMovement(new Pos(-1, 0))
17 );
18
19 // Set destructible
20 this.setDestructible(true);
21 this.setMaxHp(42);
22 this.setHp(42);
23
24 // Set the ascii art
25 this.getRenderArea().drawArray(Database.getAscii("places/quests/theSea/jellyFish"));
26
27 // Set the transparency
28 this.setTransparency(new RenderTransparency(" ", "%"));
29
30 // Set the weapon and its delay
31 this.addQuestEntityWeapon(new QuestEntityWeapon(this.getQuest(), this, new Naming("Poisoned tentacles", "poisoned tentacles"), new CollisionBoxCollection(new CollisionBox(this, new Pos(-1, -1), new Pos(8, 7))), 2));
32 this.getLastQuestEntityWeapon().getCloseCombatDelay().setFixedDelay(0);
33 }
34
35 // Public methods
36 public update(): void{

Callers

nothing calls this directly

Calls 12

setDestructibleMethod · 0.80
drawArrayMethod · 0.80
getAsciiMethod · 0.80
setTransparencyMethod · 0.80
addQuestEntityWeaponMethod · 0.80
getQuestMethod · 0.80
setFixedDelayMethod · 0.80
getCloseCombatDelayMethod · 0.80
setMaxHpMethod · 0.45
setHpMethod · 0.45
getRenderAreaMethod · 0.45

Tested by

no test coverage detected