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

Method constructor

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

Source from the content-addressed store, hash-verified

3class MiniShark extends QuestEntity{
4 // Constructor
5 constructor(quest: Quest, pos: Pos){
6 super(quest,
7 pos,
8 new Naming("A dangerous fish", "a dangerous fish"),
9 new RenderArea(19, 5),
10 new Pos(0, 0),
11 new CollisionBoxCollection(new CollisionBox(this, new Pos(8, 1), new Pos(2, 1)),
12 new CollisionBox(this, new Pos(17, 1), new Pos(2, 1)),
13 new CollisionBox(this, new Pos(5, 2), new Pos(14, 1)),
14 new CollisionBox(this, new Pos(2, 3), new Pos(17, 1)),
15 new CollisionBox(this, new Pos(0, 4), new Pos(12, 1)),
16 new CollisionBox(this, new Pos(18, 4), new Pos(1, 1))
17 ),
18 new QuestEntityMovement(new Pos(-1, 0))
19 );
20
21 // Set destructible
22 this.setDestructible(true);
23 this.setMaxHp(70);
24 this.setHp(70);
25
26 // Set the ascii art
27 this.getRenderArea().drawArray(Database.getAscii("places/quests/theSea/miniShark"));
28
29 // Set the transparency
30 this.setTransparency(new RenderTransparency(" ", "%"));
31
32 // Set the weapon and its delay
33 this.addQuestEntityWeapon(new QuestEntityWeapon(this.getQuest(), this, new Naming("Its teeth", "its teeth"), new CollisionBoxCollection(new CollisionBox(this, new Pos(-1, -1), new Pos(21, 7))), 8));
34 this.getLastQuestEntityWeapon().getCloseCombatDelay().setFixedDelay(2);
35 }
36
37 // willDie()
38 public willDie(): 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