feat: Initial Commit
This commit is contained in:
commit
c0c417369e
|
@ -0,0 +1,20 @@
|
|||
#include <stdlib.h>
|
||||
#include "dudes.h"
|
||||
|
||||
struct dude* makeDude() {
|
||||
struct dude* d = malloc(sizeof(struct dude));
|
||||
|
||||
d->hp = 100;
|
||||
d->mp = 70;
|
||||
|
||||
d->atk = 5;
|
||||
d->def = 2;
|
||||
for(int i = 0; i < 10; i++) {
|
||||
d->spells[i] = NULL;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
void destroyDude(struct dude* d) {
|
||||
free(d);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
struct dude {
|
||||
int hp;
|
||||
int mp;
|
||||
|
||||
int atk;
|
||||
int def;
|
||||
void* spells[10];
|
||||
};
|
||||
|
||||
struct dude* makeDude();
|
||||
void destoryDude();
|
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
#include "dudes.h"
|
||||
|
||||
int main() {
|
||||
int done = 0;
|
||||
|
||||
struct dude* player = makeDude();
|
||||
struct dude* enemy = makeDude();
|
||||
while(done == 0) {
|
||||
printf("STATUS HP %i MP %i\n", player->hp, player->mp);
|
||||
printf("ENEMY HP %i MP %i\n", enemy->hp, enemy->mp);
|
||||
done = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue