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

Method constructor

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

Source from the content-addressed store, hash-verified

3class Camel extends QuestEntity{
4 // Constructor
5 constructor(quest: Quest, pos: Pos){
6 super(quest,
7 pos,
8 new Naming("A camel", "a camel"),
9 new RenderArea(7, 2),
10 new Pos(0, 0),
11 new CollisionBoxCollection(new CollisionBox(this, new Pos(0, 0), new Pos(6, 1)), new CollisionBox(this, new Pos(2, 1), new Pos(5, 1))),
12 new QuestEntityMovement()
13 );
14
15 // Set gravity
16 this.getQuestEntityMovement().setGravity(true);
17
18 // Set destructible
19 this.setDestructible(true);
20 this.setMaxHp(7);
21 this.setHp(7);
22
23 // Set the ascii art and the transparent character
24 this.getRenderArea().drawArray(Database.getAscii("places/quests/desert/camel"));
25 this.setTransparency(new RenderTransparency(" "));
26
27 // Set the weapon and its delay
28 this.addQuestEntityWeapon(new QuestEntityWeapon(this.getQuest(), this, new Naming("Its long neck", "its long neck"), new CollisionBoxCollection(new CollisionBox(this, new Pos(-1, 0), new Pos(3, 3))), 5));
29 this.getLastQuestEntityWeapon().getCloseCombatDelay().setBetweenDelay(5, 7);
30 }
31
32 // Public methods
33 public willDie(): void{

Callers

nothing calls this directly

Calls 14

setGravityMethod · 0.80
setDestructibleMethod · 0.80
drawArrayMethod · 0.80
getAsciiMethod · 0.80
setTransparencyMethod · 0.80
addQuestEntityWeaponMethod · 0.80
getQuestMethod · 0.80
setBetweenDelayMethod · 0.80
getCloseCombatDelayMethod · 0.80
setMaxHpMethod · 0.45

Tested by

no test coverage detected