I recently started dabbling in Greenfoot, and so far it's working fine. However, I want to play a sound whenever S is pressed down. Naturally, I don't want it to start every single frame anew. I tried looking it up via Google, and while it seems to help everybody, it somehow doesn't work for me:
This is how it's currently set up, but it's still playing every single frame (which of course makes it horribly annoying), and I don't know how to fix it.
The code above is from my PlayerShip class (Actor > Spaceship > PlayerShip).
I'm sure I'm missing something stupidly obvious, so any input would be appreciated.
GreenfootSound lasersound = new GreenfootSound("shot_laser.wav");
if (!lasersound.isPlaying())
{
lasersound.play();
}

