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

Method addWalls

code/main/TheHole.ts:176–185  ·  view source on GitHub ↗
(...positions: number[])

Source from the content-addressed store, hash-verified

174 }
175
176 private addWalls(...positions: number[]): void{
177 // Create the wall entity
178 this.addEntity(new Wall(this, new Pos(0, 0)));
179 var wall: Wall = <Wall>(this.getLastEntity());
180
181 // Add the boxes
182 for(var i = 0; i < positions.length/4; i++){
183 wall.addBox(new Pos(positions[i*4], positions[i*4+1]), new Pos(positions[i*4+2] - positions[i*4] + 1, positions[i*4+3] - positions[i*4+1] + 1));
184 }
185 }
186
187 private calcNewGlobalDrawingOffset(): void{
188 // If the player is too low or too high on the screen (that's why we take the offset in account here), we set the offset to follow the player

Callers 1

createWallsMethod · 0.95

Calls 3

addEntityMethod · 0.80
getLastEntityMethod · 0.80
addBoxMethod · 0.80

Tested by

no test coverage detected