One of my first programming projects. I tried to learn C and use curses...it is quite embarrassing looking back at it now :D
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
793 B

#include <events.h>
#include <structs.h>
#include <world.h>
#include <getPos.h>
#include <time.h>
#include <stdlib.h>
#include <zombies.h>
int zombieModifer=0;
int itemModifier=0;
void addItem(char *type, int yPos, int xPos){
if(!strcmp(type,"Pistol Magazine")){
struct Item pistolMag = {.type="Pistol Magazine", .symbol='=', .isAlive=1, .curXpos=xPos, .curYpos=yPos};
int i;
for (i=0;i<MAX_ITEMS;i++){
if(!allItems[i].isAlive){
allItems[i]=pistolMag;
break;
}
}
}
}
void randomEvents(){
int eventTrigger = rand()%1000+1;
if (eventTrigger < 2+itemModifier){
getOpenPos();
addItem("Pistol Magazine", openPos.y, openPos.x);
}
if (eventTrigger < 10+zombieModifier){
addZombie();
zombieModifier++;
}
if (eventTrigger==zombieModifier){
addHorde();
}
}