This is fairly clunky and unnecessary, as I only have one.
How can I do this?
- Code: Select all
typedef struct playerStructAttributes {
int energy;
int health;
}playerAttributes;
playerAttributes playerstats[1];
//Called from the view when it's created
void setattributes() {
playerstats[0].energy = 0;
playerstats[0].health = 100;
}
//Called from an actor at various points
void addenergy () {
playerstats[0].energy += 5;
}