Skip to content

Instantly share code, notes, and snippets.

@nathonius
Created June 13, 2025 12:40
Show Gist options
  • Save nathonius/4a49dcf3887ee13da87bf9580e6046b0 to your computer and use it in GitHub Desktop.
Save nathonius/4a49dcf3887ee13da87bf9580e6046b0 to your computer and use it in GitHub Desktop.
GZDoom SPINNY keys
version "4.12.2"
class SpinnyKeyHandler : EventHandler
{
Array<Key> knownKeys;
override void WorldThingSpawned(worldEvent e)
{
// Try casting the spawned actor as the Key class:
let k = Key(e.thing);
// If the cast succeeded, this means this actor
// is based on the Key class, i.e. is a key:
if (k)
{
knownKeys.Push(k);
k.bWALLSPRITE = true;
k.bFLOATBOB = true;
k.FloatBobStrength = 1.0;
}
}
override void WorldTick()
{
// SPIN TO WIN
for(int i = 0; i < knownKeys.Size(); i++)
{
knownKeys[i].A_SetAngle(knownKeys[i].angle+5.0, SPF_INTERPOLATE);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment