1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
#include <iostream>
#include <windows.h>
#include "SF.h"
#include <conio.h>
using namespace std;
typedef const char name;
short int ycord = 7;
short int xcord = 4;
void start()
{
SF sfobj;
system("MODE CON COLS=25 LINES=22");//sets window size!
sfobj.clear();
bool running = 1;
const int ROWS = 10;
const int COLUMNS = 10;
double Map[ROWS][COLUMNS] = {
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,1,1,1,1,1,1} ,
{1,1,1,1,0,1,1,1,1,1}
};
while (running != 0)
{
sfobj.clear();
for (int i = 0; i < ROWS; ++i)
{
for (int k = 0; k < COLUMNS; ++k)
{
cout <<Map[i][k];
}
cout <<endl;
}
if (kbhit())//moves player up not rely working...
{
char keyup = getch();
if (keyup == 72)
{
if (ycord <= 0)
{ycord++;}
Map[ycord][ycord] = 1;
ycord = ycord - 1;
Map[xcord][xcord] = 0;
}
}
//not working...
if (kbhit())//moves player down
{
char keydown = getch();
if (keydown == 80)
{
if (ycord >= 10)
{
ycord++;
}
Map[ycord][xcord] = 1;
ycord = ycord + 1;
Map[ycord][xcord] = 0;
}
}
}
}
void help()
{
SF sfobj;
sfobj.clear();
cout <<"Help coming soon!\n";
sfobj.pause();
}
int main()
{
SF sfobj;
system("title SF");
sfobj.ver();
sfobj.pause();
system("title text tactics! (test version)");
system("color 6a");
sfobj.clear();
string input;
cout <<"\t\t\tText tactics!\a\n";
cout <<"Type 1 to start and 2 for help!\n: ";
cin >> input;
if (input == "1")
{
start();
}
else if (input == "2")
{
help();
main();
}
else
{
main();
}
return 0;
}
|