It's divided into eight files, but it runs through these files first. I'll just link two since all the files have similar problems.
FINALBOSS.h
[spoiler]
// enemy.h
// houses the enemy class
#ifndef FINALBOSS_H
#define FINALBOSS_H
using namespace std;
class FINALBOSS
{
public:
/* constructors */
FINALBOSS();
/* mutators */
void AddStamina(short alteration);
void AddHitPoints(short alteration);
/* accessors */
short GetStamina();
short GetHitpoints();
short GetPosX();
short GetPosY();
/* Display */
void DisplayFrame1();
void DisplayFrame2();
void DisplayFrame3();
void Screenshake(short speed, short duration);
void DrawStage();
/* movement */
void move_up();
void move_dn();
/* actions */
short Act_Random();
void Act_Idle(short posX, short posY);
void Act_Headbutt();
//void Act_Shoot(Enemy *, short, char);
void launchphase();
private:
HANDLE hOut; // holds window information for the class
string frame1[15];
string frame2[15];
string frame3[15];
short stamina; // the amount of hits it takes to get to launch phase
short dice, // for randomly using attacks
hitpoints; // the actual vitality of the bear
bool isActing; // whether or not the bear has finished an action
unsigned short timer; // times when the bear does things
COORD pos; // stores FINALBOSS' position
COORD defaultPos; // boss' resting coordinates
};
#endif
[/spoiler]FINALBOSS.cpp
[spoiler]
// FINALBOSS.cpp
// houses all the functions of the FINALBOSS class
#include <iostream>
#include <ctime>
#include <string>
#include <Windows.h>
#include "game.h"
#include "FINALBOSS.h"
#include "enemy.h"
/* constructors */
FINALBOSS::FINALBOSS():
stamina(1000),
hitpoints(3)
{
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
srand(time(0));
isActing = false;
COORD dice;
pos.X = 52;
pos.Y = 6;
defaultPos.X = pos.X;
defaultPos.Y = pos.Y;
dice.X = rand() % 3 + 1;
for(short i = 0, j = 5; i < 300; i++)
{
switch(dice.X)
{
case 1:
dice.X = rand() % 80 + 1;
dice.Y = rand() % 25 + 1;
SetConsoleCursorPosition(hOut, dice);
cout << BIG_STAR;
break;
case 2:
dice.X = rand() % 80 + 1;
dice.Y = rand() % 25 + 1;
SetConsoleCursorPosition(hOut, dice);
cout << POP_STAR;
break;
case 3:
dice.X = rand() % 80 + 1;
dice.Y = rand() % 25 + 1;
SetConsoleCursorPosition(hOut, dice);
cout << SMALL_STAR;
break;
default:
break;
} dice.X = rand() % 3 + 1;
Sleep(j); if (j % 2 == 0) j++;
}
frame1[0] = " ";
frame1[1] = " ____ ";
frame1[2] = " /( )|___ ";
frame1[3] = " / |\\\\\\ ";
frame1[4] = " /| ///||\\\\\\\\\\ ";
frame1[5] = " /| ////||||\\\\\\\\\\\\\\ ";
frame1[6] = " | ||||||||||||\\\\\\\\| ";
frame1[7] = " | |||||||||||\\\\\\\\\\\\| ";
frame1[8] = " | \\\\\\\\\\||||||||\\\\\\;;\\ ";
frame1[9] = " |||||::||||||///;;;;/ ";
frame1[10] = " |\\;( );|||;;;;;;;;;/ ";
frame1[11] = " \\\\;;::;;;;;;;;;;;;/ ";
frame1[12] = " | |///- -,//;;;/ ";
frame1[13] = " \\__//;;- -/+/ ";
frame1[14] = " ";
frame2[0] = " ";
frame2[1] = " ___ ";
frame2[2] = " ______/ \\ ";
frame2[3] = " / ====== ( )/, ";
frame2[4] = " // +========; \\, ";
frame2[5] = " / ::~=========; \\, ";
frame2[6] = " _/ ):========= ;;\\, ";
frame2[7] = " / |==::========= ;;;| ";
frame2[8] = " \\ / __=========== ;;;/ ";
frame2[9] = " \\| \\| ========;;;;;/ ";
frame2[10] = " |========;;;;/ ";
frame2[11] = " |\\|\\/========;;;;/ ";
frame2[12] = " ===,/;;;;;;;;; ";
frame2[13] = " ";
frame2[14] = " ";
frame3[0] = " ";
frame3[1] = " _ , ,,,,,,, ____ ";
frame3[2] = " / \\ ;;;=:::====/ \\ ";
frame3[3] = " \\_/===;( );==== ( ) | ";
frame3[4] = " | =====:::====== ;/ ";
frame3[5] = " \\---==___========= ;| ";
frame3[6] = " \\|;\\|;;;\\====== ;;;| ";
frame3[7] = " ;;;;;;\\===== ;;| ";
frame3[8] = " ;;;;;;\\==== ;;/ ";
frame3[9] = " ;;;;; |=== ;;;;/ ";
frame3[10] = " ;;;;/== ;;;;/ ";
frame3[11] = " |\\;|\\.;;;;;;;/ ";
frame3[12] = " +;;;;;;;;;// ";
frame3[13] = " ''''''''' ";
frame3[14] = " ";
DisplayFrame1();
Sleep(2000);
DisplayFrame2();
Sleep(2000);
DisplayFrame3();
Sleep(10);
Screenshake(10, 150);
DrawStage();
}
/* mutators */
void FINALBOSS::AddStamina(short alteration)
{
stamina += alteration;
}
void FINALBOSS::AddHitPoints(short alteration)
{
hitpoints += alteration;
}
/* accessors */
short FINALBOSS::GetStamina() {return stamina;}
short FINALBOSS::GetHitpoints() {return hitpoints;}
short FINALBOSS::GetPosX() {return pos.X;}
short FINALBOSS::GetPosY() {return pos.Y;}
/* Display */
void FINALBOSS::DisplayFrame1()
{
for (short i = 0; i < 15; i++)
{
SetConsoleCursorPosition(hOut, pos);
cout << frame1;
pos.Y++;
} pos.Y -= 15;
}
void FINALBOSS::DisplayFrame2()
{
for(short i = 0; i < 15; i++)
{
SetConsoleCursorPosition(hOut, pos);
cout << frame2 << endl;
pos.Y++;
} pos.Y -= 15;
}
void FINALBOSS::DisplayFrame3()
{
for(short i = 0; i < 15; i++)
{
SetConsoleCursorPosition(hOut, pos);
cout << frame3 << endl;
pos.Y++;
} pos.Y -= 15;
}
void FINALBOSS::Screenshake(short speed, short duration)
{
for(short i = 0; i < duration; i++)
{
Sleep(speed);
pos.Y = 26;
SetConsoleCursorPosition(hOut, pos);
Sleep(speed);
pos.Y = 1;
SetConsoleCursorPosition(hOut, pos);
}
}
void FINALBOSS::DrawStage()
{
for(short i = 0; i < 80; i++)
{
pos.X = i;
pos.Y = 3;
SetConsoleCursorPosition(hOut, pos);
cout << HBORD;
Sleep(5);
pos.Y = 23;
SetConsoleCursorPosition(hOut, pos);
cout << HBORD;
Sleep(5);
}
Sleep(500);
pos.Y = 2;
pos.X = 32;
SetConsoleCursorPosition(hOut, pos);
cout << "FEAR ONLY BEARS:";
pos.Y = 24;
SetConsoleCursorPosition(hOut, pos);
cout << "THE SPACE ODYSSEY";
Sleep(2000);
pos.Y = 2;
pos.X = 32;
SetConsoleCursorPosition(hOut, pos);
cout << " ";
pos.Y = 24;
pos.X++;
SetConsoleCursorPosition(hOut, pos);
cout << " ";
for(short i = 0; i < 80; i++)
{
/* top border */
pos.X = i; pos.Y = 3;
SetConsoleCursorPosition(hOut, pos);
cout << BLANK;
/* bottom border */
pos.Y = 23;
SetConsoleCursorPosition(hOut, pos);
cout << BLANK;
}
pos.X = defaultPos.X; // sfet the final boss' position
pos.Y = defaultPos.Y; // back at his idle position
}
/* movement */
void FINALBOSS::move_up()
{
if (pos.Y > 1)
pos.Y--;
}
void FINALBOSS::move_dn()
{
if (pos.Y < 10)
pos.Y++;
}
/* actions */
short FINALBOSS::Act_Random()
{
if (isActing == false)
{
dice = rand() % 3 + 1;
isActing = true;
} return dice;
}
void FINALBOSS::Act_Idle(short posX, short posY)
{
if (timer % 200 == 0)
{
if (pos.Y > posY - 7) move_up();
if (pos.Y < posY - 9) move_dn();
DisplayFrame2();
} else if (timer % 100 == 0)
{
if (pos.Y > posY - 7) move_up();
if (pos.Y < posY - 9) move_dn();
DisplayFrame3();
} timer++;
if (timer > 1000)
{
timer = 0;
isActing = false;
}
}
void FINALBOSS::Act_Headbutt()
{
if (timer > 0 && timer < 50)
{
SetConsoleTextAttribute(hOut, WHALE_GOLD);
DisplayFrame2();
SetConsoleTextAttribute(hOut, NORMAL);
DisplayFrame2();
} else if (timer > 50 && timer < 100)
{
pos.X--;
DisplayFrame1();
} else if (timer > 110 && timer < 120)
{
DisplayFrame1();
} else if (timer > 120 && timer < 170)
{
pos.X++;
DisplayFrame2();
} timer++;
if (timer > 190)
{
timer = 0;
isActing = false;
}
}
void FINALBOSS::Act_Shoot(Enemy *enemy, short iter, char mapSpace[80][25])
{
enemy->SetInSpace(true);
enemy->SetMURDERMODE(true);
if (timer > 0 && timer < 25)
{
enemy->Live(pos.X, pos.Y + 9);
SetConsoleTextAttribute(hOut, LOVE_RED);
DisplayFrame2();
SetConsoleTextAttribute(hOut, NORMAL);
DisplayFrame2();
} else if (timer > 25 && timer < 75)
{
DisplayFrame3();
enemy->move_spray(iter);
} else if (timer > 75 && timer < 100)
{
DisplayFrame2();
enemy->move_spray(iter);
} else if (timer > 100 && timer < 105)
{
enemy->Die(mapSpace);
} timer++;
if (timer > 105)
{
timer = 0;
isActing = false;
}
}
[/spoiler]Errors
[spoiler]
1>------ Build started: Project: mfufni's The Sequel, Configuration: Debug Win32 ------
1> FINALBOSS.cpp
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(19): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(299): error C2039: 'Act_Shoot' : is not a member of 'FINALBOSS'
1> c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.h(10) : see declaration of 'FINALBOSS'
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(304): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(304): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2065: 'pos' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2228: left of '.X' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2065: 'pos' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(306): error C2228: left of '.Y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(307): error C2065: 'hOut' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(308): error C3861: 'DisplayFrame2': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(309): error C2065: 'hOut' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(310): error C3861: 'DisplayFrame2': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(311): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(311): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(313): error C3861: 'DisplayFrame3': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(315): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(315): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(317): error C3861: 'DisplayFrame2': identifier not found
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(319): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(319): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(322): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(324): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(326): error C2065: 'timer' : undeclared identifier
1>c:\users\allen taylor\documents\visual studio 2010\projects\mfufni's the sequel\mfufni's the sequel\finalboss.cpp(327): error C2065: 'isActing' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
[/spoiler]Also, if any of you decide to critique my code (other than for commenting because when I originally made this, I was under a strict deadline) then it'd be cool if you could tell me if there are better ways to do any of this. This is my first array-based game, made as a console application, and it's actually fairly large. I'd like to distribute it once it's finished, so sorry if I spoiled the end boss for any of you who might be curious.
Thank you, hope I can get some answers.