Skip to content
Permalink
Browse files
IM SORRY KYLE FOR WORKING OVER YOUR STUFF
AT LEAST I IMPLEMENTED COMBAT IF YOU HIT THE GOBLIN FROM THE RIGHT HAHA FUNNY RIGHT?

SO IT WORKS AND WHEN YOU ATTACK HIM TWICE HE GOES POOF BUT IT ONLY WORKS ON THAT ONE SPECIFIC GOBLIN

IT DOESN'T WORK IF YOU MAKE ANY OTHERS

ANYWAY IT STILL WORKS AS A PROTOTYPE SO I'LL GET WORKING ON IT TOMORROW IF EVERYONE IS COOL WITH IT
  • Loading branch information
ivascua committed Feb 7, 2020
1 parent 3309f6d commit ff3da6ec0f7573638be89e8aada558c54edf5701
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 10 deletions.
@@ -1,13 +1,10 @@
#include "Character.h"

int x = 1;
int y = 1; //position of player

char map[15][15] = { //static map in array
"**************",
"*@ *",
"* *",
"* *",
"* G *",
"* *",
"* *",
"* *",
@@ -51,4 +48,4 @@ void Character::Movement(int Vertical, int Horizontal)
map[y][x] = '@';
}*/

}
}
@@ -4,6 +4,13 @@ class Character
{
public:
void Movement(int Vertical, int Horizontal);
int health=10,xp=0,attack=4,x=1,y=1;
};

class monster
{
public:
int health=6,attack=3,x=3,y=3;
};

extern char map[15][15];
@@ -1,16 +1,17 @@
#include <iostream>
#include "Character.h"
#include "Windows.h"
#include "saveAndLoad.cpp"

using namespace std;

bool gameStarted = true;

Character character;
monster goblin;

int main()
{
//cout << "WELCOME TO THE GAME\nPRESS ENTER TO START" << endl;

while (gameStarted) // while the game has started
{
@@ -32,8 +33,29 @@ int main()
if (GetAsyncKeyState(0x44)) // 0x44 is the virtual key code for the w key, checks if w has been pressed
character.Movement(0, 1); // moves right

if (GetAsyncKeyState(0x41)) // 0x41 is the virtual key code for the w key, checks if w has been pressed
character.Movement(0, -1); // moves left

if (GetAsyncKeyState(0x41)) // 0x41 is the virtual key code for the w key, checks if w has been pressed
{ if ((character.x==goblin.x+1) && (character.y==goblin.y))
{
goblin.health-=character.attack;
if (goblin.health < 0){
cout<<"You killed him lmao";
map[goblin.x][goblin.y]=' ';
}
}
if (((character.x==goblin.x-1) && (character.y==goblin.y)) || ((character.x==goblin.x+1) && (character.y==goblin.y)) || ((character.x==goblin.x) && (character.y==goblin.y+1)) || ((character.x==goblin.x) && (character.y==goblin.y-1))){
character.health-=goblin.attack;
}

character.Movement(0, -1); // moves left
}
if (GetAsyncKeyState(0x50)) //0x50 is the virtual key code for the p key, checks if P has been pressed
{ //Hopefully creates a .txt file
//saveGame();
}

if (GetAsyncKeyState(0x4C))
{
//loadGame();
}
}
}
}
@@ -0,0 +1,22 @@
#include <iostream>
#include <fstream>
using namespace std;

void saveGame(){
ofstream outFile;
outFile.open("sample.txt");
outFile << "This is a test.";
outFile.close();
}

/*
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
*/

0 comments on commit ff3da6e

Please sign in to comment.