MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / CheckForLevelChange

Method CheckForLevelChange

Player.js:1118–1145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1116 }
1117
1118 CheckForLevelChange() {
1119 if (this.currentPos.y < -this.height) {
1120 //we are at the top of the screen
1121 this.currentLevelNo += 1;
1122 this.currentPos.y += height;
1123
1124
1125 } else if (this.currentPos.y > height - this.height) {
1126 if (this.currentLevelNo === 0) {
1127 //oh no
1128 // print("fuck me hes goin under")
1129 this.currentLevelNo = 1; //lol fixed
1130 this.playersDead = true;
1131 this.hasFinishedInstructions = true;
1132 }
1133 this.currentLevelNo -= 1;
1134 this.currentPos.y -= height;
1135
1136 if (!this.hasFinishedInstructions && this.currentLevelNo < this.bestLevelReached - 1) {
1137 this.fellToPreviousLevel = true;
1138 this.fellOnActionNo = this.brain.currentInstructionNumber;
1139 this.hasFinishedInstructions = true;
1140 }
1141
1142 }
1143
1144
1145 }
1146
1147 UpdateAIAction() {
1148 // ran every frame

Callers 1

UpdateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected