Creating a boolean and once pressed it turns the boolean to true, if the animation played once reset the boolean to false. And keep checking if the boolean's value. If you want the animation to play once:
#include "DarkGDK.h"
bool playAni = false;
void DarkGDK()
{
dbSyncOn();
dbSyncRate(60);
dbSetImageColorKey(255, 0, 255);
dbCreateAnimatedSprite(1, "Sprite.bmp", 4, 4, 1);
dbSprite(1, 50, 50, 1);
while (LoopGDK())
{
if(dbControlKey() == 1)
{
playAni = true;
}
if(playAni)
{
dbPlaySprite(1, 1, 16, 60);
if(dbSpriteFrame(1) == 16)
playAni = false;
}
dbSync();
}
}
else use dbLoopObject() instead of dbPlaySprite().
EDIT: new script.