Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
<OnUpdate>
<KeyPress Keys="1">
<OnPressed>
<ZExpression>
<Expression>
<![CDATA[trace ("Exit");
quit();]]>
</Expression>
</ZExpression>
</OnPressed>
</KeyPress>
</OnUpdate>
</ZApplication>
Now try running it again. It'll quit by itself.
This is bad because for example if your game crashes during playtesting, the next time you launch it the KeyPress component will act as if you're still pressing whatever it was you were pressing at the moment of the crash. This can result in some truly bizarre ingame behavior.
The only way to "revive" the KeyPress component is to press the key (that it thinks you're still holding down) again.