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

Method update

code/main/DeveloperEntityText.ts:30–52  ·  view source on GitHub ↗
(dev: DeveloperEntity)

Source from the content-addressed store, hash-verified

28
29 // Public methods
30 public update(dev: DeveloperEntity): void{
31 // Iterate over strings
32 for(var i = 0; i < this.text.length; i++){
33 // If there's a character at the current xPos of this string
34 if(this.xPos < this.text[i].length && this.text[i][this.xPos] != " "){
35 // Add a magic ball, depending on the character
36 switch(this.text[i][this.xPos]){
37 case "B":
38 dev.addMagicBall(this.textPos.plus(new Pos(this.xPos, i)), this.damage, this.timeToLive - this.xPos, ColorType.DEVELOPER_BLUE);
39 break;
40 case "Y":
41 dev.addMagicBall(this.textPos.plus(new Pos(this.xPos, i)), this.damage, this.timeToLive - this.xPos, ColorType.DEVELOPER_YELLOW);
42 break;
43 case "O":
44 dev.addMagicBall(this.textPos.plus(new Pos(this.xPos, i)), this.damage, this.timeToLive - this.xPos, ColorType.DEVELOPER_ORANGE);
45 break;
46 }
47 }
48 }
49
50 // Increase xPos
51 this.xPos += 1;
52 }
53}

Callers

nothing calls this directly

Calls 2

addMagicBallMethod · 0.80
plusMethod · 0.80

Tested by

no test coverage detected