Изменить 'a4/game.c'

This commit is contained in:
Oleksandr Hryshchenko 2021-04-17 16:40:53 +00:00
parent 2bba9bdbdb
commit 0e5571b2e8

View File

@ -69,20 +69,7 @@ int game_event(struct event* event,void* game){
int cx = state->catx_position + state->catx;
int cy = state->caty_position + state->caty;
if (cx < 1 || cy < 0 || cx > event->width || cy > event->height){
/*state->catx_position = cx;
state->caty_position = cy;
if(state->catx_position < 0){
state->catx_position = 0;
}
else if(state->catx_position >= event->width){
state->catx_position = event->width-1;
}
else if(state->caty_position < 0){
state->caty_position = 0;
}
else if(state->caty_position >= event->height){
state->caty_position = event->height-1;
}*/
}
else {
state->catx_position = cx;
@ -109,7 +96,6 @@ int game_event(struct event* event,void* game){
state->mousey[i] += 1;
}
}
//Je
}
else if (event->type == EVENT_KEY){
// Move cat according to keyboard
@ -131,14 +117,14 @@ int game_event(struct event* event,void* game){
}
}
// Draw world state
//
// Draw cat
clear_screen();
set_color_cell('c',state->catx_position,state->caty_position,COLOR_YELLOW,COLOR_RED);
set_color_cell('-',state->catx_position-1,state->caty_position,COLOR_YELLOW,COLOR_GREEN);
//set_cell('c',state->catx_position,state->caty_position);
// Draw mouse
// Draw mouse
for(int i = 0; i < MOUSE_COUNT; i++){
if(state->mouse_state[i] != 1){
set_cell('m', state->mousex[i], state->mousey[i]);