Quote:
This code I THOUGHT would play a sound when I hit the "j" key.
Instead, it plays at startup and if i do press the "j" key, the engine aborts with "acknex.exe has encountered a problem..."!
Is this not the right code for it?
Code:
on_j= smb_jump();
...
function smb_jump()
{
snd_play (jump_snd,100,0);
}
I already tried a while() loop, but all that does is play the sound every frame cycle, and that gets really annoying.
So, can anyone help?
Common mistake.
on_j = smb_jump(); // This *runs* the function smb_jump, and assigns its return to on_j
on_j = smb_jump; // This assigns the function itself to on_j
You want the second one.