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

Method handleFlames

code/main/Devil.ts:112–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110 }
111
112 private handleFlames(): void{
113 // Create the variables
114 var minX: number = 0;
115 var maxX: number = 15;
116 var minY: number = 6;
117 var maxY: number = 15;
118 var howManyFlames: number = 150;
119 var x: number;
120 var y: number;
121
122 // Add flames depending on the current timer time
123 for(var i = 0; i < howManyFlames; i++){
124 // If there is no flame for this index OR one chance out of 7
125 if(i >= this.flames.length || Random.oneChanceOutOf(7)){
126 // Set y
127 y = null;
128 for(var j = minY; j < maxY; j++){
129 if(Random.oneChanceOutOf(3)){
130 y = j;
131 break;
132 }
133 }
134 if(y == null) y = maxY;
135
136 // Set x
137 x = Random.between(minX + Math.floor((15-y)/3), maxX - Math.floor((15-y)/3));
138
139 // Add or replace the flame
140 var flame: CauldronFlame = new CauldronFlame(new Pos(x, y), Random.fromArray([")", "(", "`", "'", ".", ";", ":", ",", "-", "/", "\\", "|", "\"", "d", "e", "v", "i", "l"]));
141 if(i >= this.flames.length) this.flames.push(flame);
142 else this.flames[i] = flame;
143 }
144 }
145 }
146
147 private handleUpDownMovement(): void{
148 // If we're going down but we're too low or it will be impossible, we now go up

Callers 1

updateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected