Ok, I'm working on a class for a little console game, I have two conundrums that have anihilated my brain (Which building the game has already destroyed a good bit of -,-)...
First, you need to see the class:
Mmmm, some of you might see my problem. I have no bloody idea how to pull a part of information out of the class that I put in it! :/. I ended up stairing blankly thinking about how a co-ordinant relate to a tag... That didint go anywhere.Code:#include <windows.h> //Theyse are includes for the whole game. #include <iostream> #include <string.h> #include <conio.h> #include <fstream.h> using namespace std; class Enemy { private: HANDLE hOt = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE); char type; int x_pos; int y_pos; int tag; SHORT alive; public: Enemy(); Enemy(char t, int ex, int ey, int etag, SHORT dead) {t=type;ex=x_pos;ey=y_pos;etag=tag; dead=alive} int EnemyTracker[50][1]; int GetTagXY(int x, y); Enemy GetEnemyStatsXY(int x, y); COORD GetEnemyStatusXY(Enemy e); } COORD Enemy::GetEnemyXY(Enemy e) { int x_pos, y_pos; DWORD reader; char Ace[1]; COORD Pos; Pos.X = x; Pos.Y = y; ReadConsoleOutputCharacter(hOt, &Ace[0], 1, Pos, &reader); if(Ace[0] == Enemy1 || Ace[0] == Enemy2 || Ace[0] == Enemy3 || Ace[0] == Enemy4) { Pos.X = x; Pos.Y = y; return Pos; } int Enemy::GetTagXY(int x, y) { int x_pos, y_pos; DWORD reader; char Ace[1]; COORD Pos; Pos.X = x; Pos.Y = y; ReadConsoleOutputCharacter(hOt, &Ace[0], 1, Pos, &reader); if(Ace[0] == Enemy1 || Ace[0] == Enemy2 || Ace[0] == Enemy3 || Ace[0] == Enemy4) return tag; } Enemy Enemy::GetEnemyStatusXY(int x, y) { int x_pos, y_pos; DWORD reader; char Ace[1]; COORD Pos; Pos.X = x; Pos.Y = y; ReadConsoleOutputCharacter(hOt, &Ace[0], 1, Pos, &reader); if(Ace[0] == Enemy1 || Ace[0] == Enemy2 || Ace[0] == Enemy3 || Ace[0] == Enemy4) return Enemy; }
So, what I'm trying to do is, be able to declare an enemy, lets say:
But... How do I do this -,-. My brain is in like... Meltdown mode ... I'm hoping theres a simple answer, but for now, I'll just stair blankly at my program and hope an answer magicaly pops into my head (it wont :/).Code:int main() { Enemy Hi('&', 15, 27, 1); COORD Pos; Pos=GetEnemyXY(Hi); cout << GetTagXY(Pos.x, Pos.y); }
Any help is greatly apreciated. Also, I'm taking donations to recover my brain particles and rebuild them >.<.



LinkBack URL
About LinkBacks


