Please I need your help.
1.How to connect character object with "@" from the map and enemy object with "%"?
2.How to make different enemyes with diferent parameters like file or list or…and to connect with simbol “%”?
class Map.h
#pragma once
#include <windows.h>
#include <stdlib.h>
#include "Character.h"
//#include "Player.h"
class theMap
{
private:
bool game_running = true;
Character* ch;
int x=1;
int y=1;
char map[32][84] = {
"################################################################################",
"#@ ____ #",
"# { }* { } { } ___ <____> #",
"# { }//{ }//{ }// { } ++++++++++ <___> #",
"# *//{ }//{ }//*{ }//{ } % / / |+++++++++++ | | +++#",
"# { }- F O R E S T / / / / |++++++++ ++++++++| #",
"# // *{ } *{ } * { }* { }// / D O C K |++++++++++| #",
"# { }//{ }// { }//{ }// % / / #",
"# // * // * *// * // %___/___________~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#",
"# { } { } { } % |M T| #",
"# // // // % | A E |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#",
"# % R K | % #",
"# % % |_____________| % % #",
"# % /// ////// //// % #",
"# % |-| |----| |--| % #",
"# % | | | | | | % #",
"# ^^ ^^ ^^ ^^ % | | | | | | % #",
"# /=/ /=/ /=/ /=/ % % ^^^^^^^^^^^^^^^^^^^^ #",
"# V I L A G E % % |------------------| #",
"# ^^ ^^ ^^ ^^ % % | | #",
"# /=/ /=/ /=/ /=/ % % P A L A C E | #",
"# |====================== % #",
"# % #",
"# ______________________|__________ % #",
"# % [ ______________________________ ]__ __ #",
"# | | | | <=============> #",
"# % % ______ | #",
"# [ ( % A R E N A ) ] | A R M O R Y | #",
"# [ ( | | | | ) ] | | #",
"# [ (______________________________) ] <=============> #",
"# [________________________________] #",
"################################################################################"
};
public:
theMap() {}
theMap(int x, int y, Character * ch) {
this->x = x;
this->y = y;
this->ch = ch;
}
~theMap() {}
void moveChar();
void fullscreen();
};
class Map.cpp
#include "theMap.h"
#include "Character.h"
#include <iostream>
#include <windows.h>
#include <stdlib.h>
//#include <exeption>
using std::endl; using std::cout;
using std::string;
void theMap::moveChar() {
while (game_running = true) {
system("cls");
for (int i = 0; i < 32; i++) {
for (int j = 0;j < 84;j++) {
cout << map[i] << endl;
if (j == ch->getX() && i == ch->getY()){
map[i][j] = '@';
cout << map[j] << endl;
}
}
}
cout << "\n\n\nPress Escape to exit the game.\n\n\n";
system("pause");
if (GetAsyncKeyState(VK_DOWN)) {
int y2 = y + 1;
if (map[y2][x] == ' ') {
map[y][x] = ' ';
y++;
map[y][x] = '@';
if (map[5][18]) {
cout << "Wewkom to the FOREST";
}
}
}
if (GetAsyncKeyState(VK_UP)) {
int y1 = y - 1;
if (map[y1][x] == ' ') {
map[y][x] = ' ';
y--;
map[y][x] = '@';
}
}
if (GetAsyncKeyState(VK_LEFT)) {
int x2 = x - 1;
if (map[y][x2] == ' ') {
map[y][x] = ' ';
x--;
map[y][x] = '@';
if (map[y][x] = '@' == map[5][25]) {
system("pause");
cout << "Wellcome to the FOREST";
}
}
}
if (GetAsyncKeyState(VK_RIGHT)) {
int x1 = x + 1;
if (map[y][x1] == ' ') {
map[y][x] = ' ';
x++;
map[y][x] = '@';
}
}
if (GetAsyncKeyState(VK_ESCAPE)) {
cout << "\n\n\nThank you for the game!\n\n\n";
exit(3);
}
}
}
void theMap::fullscreen()
{
keybd_event(VK_MENU, 0x38, 0, 0);
keybd_event(VK_RETURN, 0x1c, 0, 0);
keybd_event(VK_RETURN, 0x1c, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0x38, KEYEVENTF_KEYUP, 0);
}
class Character.h
#pragma once
#include <string>
#include <iostream>
using std::string;
class Character
{
private:
string m_name;
int m_level, m_hp, m_strenght, m_intelligence,m_money;
int x =1;
int y =1;
public:
Character();
Character(string name, int level, int hp, int strenght, int intelligence, int money, int x1, int y1);
void SetCharacter(int x, int y);
const int getX(void)const;
const int getY(void)const;
/*void attack();
void defend();
void levelUp();*/
};
class Character.cpp
#include "Character.h"
#include<iostream>
#include <windows.h>
#include <stdlib.h>
Character::Character() {
m_name = "Witcher";
m_level = 1;
m_hp = 100;
m_strenght = 10;
m_intelligence = 10;
m_money = 140;
x = 1;
y = 1;
}
Character::Character(string name, int level, int hp, int strenght, int intelligence, int money, int x, int y)
{
m_name = name;
m_level = level;
m_hp = hp;
m_strenght = strenght;
m_intelligence = intelligence;
m_money = money;
this-> x=x;
this-> y=x;
}
void Character:: SetCharacter(int x, int y) {
this->x = x;
this->y = x;
}
const int Character::getX(void)const {
return x;
}
const int Character::getY(void)const {
return y;
}
class Enemy.h
#pragma once
#include <iostream>
class Enemy
{
private:
};
class Enemy.cpp
#include "Enemy.h"
Main
#include "theMap.h"
#include <iostream>
int main()
{
theMap m;
m.fullscreen();
m.moveChar();
return 0;
}