Hello,
I'm using the DX Studio engine (used to develop 3d games/applications), which uses javaScript as the main language.
Since the engine is not getting much attention, their forum is almost completely dead. So I thought maybe one of you here at daniWeb could help me out?
When previewing my application it crashes. I'm sure it's because of the while loop, but why, I don't know:
(Some of these is DX Studio events, but I just want you to look at the while loop)
// Variable
var run = false;
// Detect if "w" key is down
function onKeyChange(input)
{
if ( input.keyId == "w" && input.keyDown )
{
run = true;
// Begin printing "True" to the console
while ( run == true )
{
print("True");
// When run is false, print "False" and escape the loop with break
if ( run == false )
{
print("False");
break;
}
}
}
// Detect if "w" key is released
else if ( input.keyId == "w" )
{
run = false;
}
}
So, when W is down, it prints "True" and when it's released it should print "False" and escape the loop with break. But this causes the application to crash.
Any ideas?
Chris