Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Loops
let endPos = 5; var xPos = 0; var enemyPos = 4; var isGameOver = false /*while(!isGameOver) { // <--- While game is not GameOver the loop will continue xPos++; // <-- Position moved up 1 if (xPos >= endPos || xPos == enemyPos){ // If position is equal or greater then End Position or position equals to Enemy position it's gameover isGameOver = true; } } while(xPos < endPos){ //While End position is greater then position the loop continues xPos++; if( xPos == enemyPos){ // If position equals to enemy position loop break break; } }*/ /*while(xPos < endPos){ if (xPos % 2 == 1){ continue; } xPos++; if( xPos == enemyPos){ break; }*/ function movePlayer(){ while(xPos < endPos){ xPos++; if (xPos == enemyPos) { return; } } }
run
|
edit
|
history
|
help
0
class Stack
p
JSON magic
Rocket Science
My first app
rstring
Just stop thinking about it and go eat
Javascript Basics If statements
Prime Number
Triangle