-
-
Save lethal-guitar/6ca0aa69786c7ad8a2319489503850b0 to your computer and use it in GitHub Desktop.
Duke Nukem 1 bouncy mine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Lookup table | |
The numbers are in 1/8th of a pixel. | |
See https://lethalguitar.wordpress.com/2023/11/12/duke-nukem-1s-sprite-rendering/#coordinate-systems | |
*/ | |
int BOUNCE_MINE_JUMP_ARC[] = | |
{128, 96, 64, 32, 8, 4, 1, -1, -4, -8, -32, -64, -96, -128}; | |
/* | |
Bouncing logic | |
Runs once every frame for each bouncy mine actor | |
actor->state is initially -6 | |
*/ | |
actor->y -= BOUNCE_MINE_JUMP_ARC[actor->state + 6]; | |
actor->state++; | |
if (actor->state == 8) | |
{ | |
actor->state = -6; | |
} | |
if (actor->state == -6) | |
{ | |
PlaySound(SND_MINE_BOUNCE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment