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

Method constructor

code/main/DesertBird.ts:5–29  ·  view source on GitHub ↗
(quest: Quest, pos: Pos, goingRight: boolean)

Source from the content-addressed store, hash-verified

3class DesertBird extends QuestEntity{
4 // Constructor
5 constructor(quest: Quest, pos: Pos, goingRight: boolean){
6 super(quest,
7 pos,
8 new Naming("A desert bird", "a desert bird"),
9 new RenderArea(9, 4),
10 new Pos(0, 0),
11 new CollisionBoxCollection(new CollisionBox(this, new Pos(0, 0), new Pos(9, 4)))
12 );
13
14 // If we're heading to right
15 if(goingRight){
16 this.setQuestEntityMovement(new QuestEntityMovement(new Pos(1, 0)));
17 this.setQuestEntityAnimation(new QuestEntityAnimation(3, Random.upTo(2), Random.upTo(1), "places/quests/desert/birdRightUp", "places/quests/desert/birdRightDown"));
18 }
19 // Else
20 else{
21 this.setQuestEntityMovement(new QuestEntityMovement(new Pos(-1, 0)));
22 this.setQuestEntityAnimation(new QuestEntityAnimation(3, Random.upTo(2), Random.upTo(1), "places/quests/desert/birdLeftUp", "places/quests/desert/birdLeftDown"));
23 }
24
25 // Set destructible
26 this.setDestructible(true);
27 this.setMaxHp(6);
28 this.setHp(6);
29 }
30
31 // willDie()
32 public willDie(): void{

Callers

nothing calls this directly

Calls 5

setDestructibleMethod · 0.80
setMaxHpMethod · 0.45
setHpMethod · 0.45

Tested by

no test coverage detected