Ok here is the .h for the Enemy class
Code:
#ifndef INCLUDED_ENEMY
#define INCLUDED_ENEMY
#include "GameConsole.h"
using namespace std;
class Enemy {
public:
Enemy();
double hast;
double xPosition;
double yPosition;
int Enemy_width;
int Enemy_height;
const string EnemyImageFilename;
const int ENEMYIMAGE_X_FRAME_COUNT;
const int ENEMYIMAGE_Y_FRAME_COUNT;
GCImage EnemyImage;
~Enemy();
void render();
void move(double execution_time);
};
#endif
And here is the .cpp:
Code:
#include "Enemy.h"
Enemy::Enemy():
hast(200),
xPosition(500),
yPosition(0),
EnemyImageFilename ("EnemyImage.jpg"),
ENEMYIMAGE_X_FRAME_COUNT (1),
ENEMYIMAGE_Y_FRAME_COUNT (1)
{
EnemyImage = VGCDisplay::openImage(
EnemyImageFilename,
ENEMYIMAGE_X_FRAME_COUNT,
ENEMYIMAGE_Y_FRAME_COUNT
);
Enemy_width = GCDisplay::getWidth(EnemyImage);
Enemy_height = GCDisplay::getHeight(EnemyImage);
}
//movement
void Enemy::move(double execution_time){
yPosition+=execution_time*hast;
}
void Enemy::render(){
GCVector frameIndex = GCVector(0,0);
GCVector position = GCVector((int)xPosition,(int)yPosition);
GCAdjustment adjustment = GCAdjustment(0.5,0.5);
GCDisplay::renderImage(EnemyImage,frameIndex,position,adjustment);
}
Enemy::~Enemy(){
GCDisplay::closeImage(EnemyImage);
}
Hope that should help!