Skip to content

Instantly share code, notes, and snippets.

@Mikepicker
Created November 20, 2017 12:53
Show Gist options
  • Save Mikepicker/facedeba0706cccb3bdcb12e363ae1b9 to your computer and use it in GitHub Desktop.
Save Mikepicker/facedeba0706cccb3bdcb12e363ae1b9 to your computer and use it in GitHub Desktop.
const int ZOMBIE_COUNT = 20;
const int SPAWN_FREQ = 3;
unsigned int lastSpawnTime = 0, currentTime;
int zombieAnimSpeed = 8;
int zombieSpeed = 3;
SDL_Texture* zombieTexture;
struct Zombie {
float x, y;
int w = 64; // Width and height have been moved here for a cleaner code
int h = 64;
float vX, vY;
int dir;
int frameX, frameY;
bool animCompleted = false; // Is the attack animation completed?
bool attack = false; // Has the zombie inflicted damage?
bool alive = false;
std::string state;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment