Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <ncurses.h>
#include <array>
#include <cstdlib>
#include "player.h"
#include <stdlib.h>
#include "mainMenu.h"
#include "enemy.h"
#include "terminalSize.h"
#include "collision.h"
#include "music_play.h"
// --^--\
// | >
// --v--/
using namespace std;
void encounter(WINDOW* win);
int main()
{
initscr();
noecho();
cbreak();
//compile with music_play.cpp on the command line aswell as -lsfml-audio and -pthread
createMusicThread();
int ymax, xmax;
getxy(ymax, xmax); // Returns terminal size (max y and max x)
WINDOW* sea=mainMap(ymax, xmax);
if (startMenu()=="New Game")
{
Island island1(10, 20, 10, 60);
island1.newIsland();
Enemy enemy(sea, 13, 30, 'O');
enemy.display();
Player player(sea, 1, 1, '@');
bool first=true;
if (first==true){
for (int i=0; i<ymax-14;i++)
{
player.mvright();
player.mvdown();
if (i==ymax-15)
first=false;
}
}
int n=1;
do {
island1.newIsland();
if (collision(player, island1)==true)
{
mvwprintw(sea, 1, 1, "%d", n);
n++;
}
if (enemy.get_y()==player.get_y() && enemy.get_x()==player.get_x())
{
encounter(sea);
}
player.display();
refresh();
} while(player.getmv()!='x');
}
//getch();
endwin();
return 0;
}
void encounter(WINDOW* win)
{
mvwprintw(win, 5, 8,"Enemy has been slain");
}