Изменить 'a4/game.c'
This commit is contained in:
parent
0e5571b2e8
commit
2a0aed698e
18
a4/game.c
18
a4/game.c
@ -10,14 +10,14 @@ void* init_game(){
|
|||||||
struct game* st = calloc(1,(sizeof(struct game)));
|
struct game* st = calloc(1,(sizeof(struct game)));
|
||||||
// Initialize state
|
// Initialize state
|
||||||
for(int i = 0; i < MOUSE_COUNT; i++){
|
for(int i = 0; i < MOUSE_COUNT; i++){
|
||||||
st->mousex[i] = rand()%15;
|
st->mousex[i] = rand()%15; // Рандомная позиция мышей на карте
|
||||||
st->mousey[i] = rand()%15;
|
st->mousey[i] = rand()%15; // --//--
|
||||||
st->mouse_state[i] = 0;
|
st->mouse_state[i] = 0; // состояние мышы -- жива
|
||||||
}
|
} //генерация мышей
|
||||||
st->catx = 0;
|
st->catx = 0; //скорость кота
|
||||||
st->caty = 0;
|
st->caty = 0; // --//--
|
||||||
st->catx_position = 15;
|
st->catx_position = 15; // Позиция кота на карте
|
||||||
st->caty_position = 15;
|
st->caty_position = 15; // --//--
|
||||||
// Store pointer to the state to the world variable
|
// Store pointer to the state to the world variable
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ void* init_game(){
|
|||||||
// It should modify the state and draw it.
|
// It should modify the state and draw it.
|
||||||
int game_event(struct event* event,void* game){
|
int game_event(struct event* event,void* game){
|
||||||
// Get state pointer
|
// Get state pointer
|
||||||
struct game* state = game;
|
struct game* state = game; // Зоздание игры
|
||||||
char msg[200];
|
char msg[200];
|
||||||
sprintf(msg,"%d",event->type);
|
sprintf(msg,"%d",event->type);
|
||||||
set_message(msg,10,0);
|
set_message(msg,10,0);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user