StPoint, used to represent the location on the map,
StGame, role
Struct stPoint
{
int x;//coordinates x
int y;//y
}
Struct stGame
{
Char Name [0 x20];//monster name
Int Level;//the monster level
Int "Blood;//monster blood values
StPoint Point;//position monster
Int the Status;//monsters live state 0 1 dead
The int Type.//type: 0 3 player 1 NPC blame
}
2, define an array GameArr, can store 10 stGame;
Init 3, write a function for GameArr assignment: a player and an NPC, eight strange, other types of set myself
4, write a function Show that the output information all blame;
5, write a function is Dead, can according to the number changes monster Status, according to the parameter to 0 or 1;
6, and write a function to Attack, reduces the monster blood value closest to the toy 10 points reduced to 0 (at least), if the monster is Dead, Dead function called,
Just learning c language for bosses to help answer.
CodePudding user response:
Basic structure using topic, first try to write about yourself, don't make a mistake, how can anyone know structure can't use? !