Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple death fader for GZDoom. Put both files into a .pk3 or .wad.
GameInfo {
AddEventHandlers = "DeathFadeBootstrap"
}
version "4.1"
class DeathFadeBootstrap : EventHandler {
override void PlayerDied(PlayerEvent e) {
PlayerInfo player = players[e.PlayerNumber];
player.mo.GiveInventory("DeathFader", 1);
}
override void PlayerRespawned(PlayerEvent e) {
PlayerInfo player = players[e.PlayerNumber];
player.mo.TakeInventory("DeathFader", 1);
}
}
class DeathFader : Inventory {
int counttoblack;
override void AttachToOwner(actor User) {
super.AttachToOwner(user);
counttoblack = (owner.health + random(5, 20)) * 35;
counttoblack = max(counttoblack, 10);
owner.A_SetBlend("black", 0.0, counttoblack, "black", 1.0);
}
override void DoEffect() {
if (counttoblack <= 2 && owner.health <= 0) {
owner.A_SetBlend("black", 1.0, 5, "black", 1.0);
}
counttoblack--;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.