Added 'L' monster
This commit is contained in:
parent
5d33704d64
commit
f1eb2ffefb
21
main.c
21
main.c
@ -26,7 +26,7 @@ Character new_character(int row, int col, char symbol)
|
|||||||
static inline bool check_screen();
|
static inline bool check_screen();
|
||||||
static inline void init();
|
static inline void init();
|
||||||
static inline void boot();
|
static inline void boot();
|
||||||
static inline void game_loop(Character main_char, Character monster, int ch);
|
static inline void game_loop(Character main_char, Character monster, Character monster2, int ch);
|
||||||
void move_char (int y, int x);
|
void move_char (int y, int x);
|
||||||
void draw_borders(WINDOW *screen);
|
void draw_borders(WINDOW *screen);
|
||||||
|
|
||||||
@ -101,6 +101,7 @@ void draw_borders(WINDOW *screen) {
|
|||||||
static inline void boot(){
|
static inline void boot(){
|
||||||
Character main_char = new_character(10,10,'@');
|
Character main_char = new_character(10,10,'@');
|
||||||
Character monster = new_character (12,12,'M');
|
Character monster = new_character (12,12,'M');
|
||||||
|
Character monster2 = new_character (18,18,'L');
|
||||||
|
|
||||||
printw("Welcome to fucktastic games lotto.\nPress \"q\" to quit or any other key to continue\n");
|
printw("Welcome to fucktastic games lotto.\nPress \"q\" to quit or any other key to continue\n");
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ static inline void boot(){
|
|||||||
// No longer wait for characters if nothing is typed
|
// No longer wait for characters if nothing is typed
|
||||||
// nodelay(stdscr, true);
|
// nodelay(stdscr, true);
|
||||||
|
|
||||||
game_loop(main_char, monster, ch);
|
game_loop(main_char, monster, monster2, ch);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +147,18 @@ int attack(char target){
|
|||||||
getch();
|
getch();
|
||||||
hide_panel(mypanel);
|
hide_panel(mypanel);
|
||||||
}
|
}
|
||||||
|
else if (target == 'L'){
|
||||||
|
WINDOW *mywindow = newwin(10,20,7,8);
|
||||||
|
getmaxyx(mywindow, max_y, max_x);
|
||||||
|
box(mywindow,0,0);
|
||||||
|
PANEL *mypanel = new_panel(mywindow);
|
||||||
|
|
||||||
|
mvwprintw(mywindow, 1, 1, "He raped you!");
|
||||||
|
update_panels();
|
||||||
|
doupdate();
|
||||||
|
getch();
|
||||||
|
hide_panel(mypanel);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -159,7 +171,7 @@ int col_detect (int y, int x) {
|
|||||||
if (target == '#'){
|
if (target == '#'){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (target == 'M'){
|
else if (target == 'M' || target == 'L'){
|
||||||
attack(target);
|
attack(target);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -170,13 +182,14 @@ int col_detect (int y, int x) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void game_loop(Character main_char,Character monster, int ch){
|
static inline void game_loop(Character main_char,Character monster,Character monster2, int ch){
|
||||||
|
|
||||||
int row = main_char.row;
|
int row = main_char.row;
|
||||||
int col = main_char.col;
|
int col = main_char.col;
|
||||||
|
|
||||||
mvaddch(row, col, main_char.symbol);
|
mvaddch(row, col, main_char.symbol);
|
||||||
mvaddch(monster.row, monster.col, monster.symbol);
|
mvaddch(monster.row, monster.col, monster.symbol);
|
||||||
|
mvaddch(monster2.row, monster2.col, monster2.symbol);
|
||||||
|
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user