Is there a way in game lab to tell the computer to go back to a previous line of code?
Basically, Can I tell it if I push the space bar to go back to line 10 or something??
Is there a way in game lab to tell the computer to go back to a previous line of code?
Basically, Can I tell it if I push the space bar to go back to line 10 or something??
You can’t tell it to go to a specific line number of code. This does sound like an if statement or function. An if statement is a little easier. For example:
if(keyDown(“space”)) {
do something
}
OR
So each time the space key is pressed, it runs the code inside the brackets.
Hope that helps!
~Michelle
if your refering to a jump command type of code top level functions are your basic goto operators for this sort of thing
function jump() {
console.log("this is line 2");
}
var a = 0;
var b = 1;
jump();
console.log(b)
jump();
orrr you can use listeners which is what @melynn has suggested either way both work just have different use cases