Week 6 | Red Plane1942
|
I’ve started working on a replica of a game called ”Red Plane 1942″. I’m using the same engine we created in class for the Arkanoid project. What I’ve done this week is to create the basic objects. I made a class called BackgroundObject. It’s basically just a object with a sprite that moves down towards the end of the screen. After it is below the edge it resets above the screen and randomizes a x position. The Player object is always on the samy Y position, when the BackgroundObjects move down they create the illusion of the player flying forward. So the BackgroundObject class inherits from the base class called Entity. I also started creating a Bullet class wich also inherits from the Entity class. The Bullet class has variables for X and Y direction, speed and damage.
class Bullet : public Entity
{
public:
Bullet(float x, float y, Sprite* sprite, int damage, int speed, int xDirection, int yDirection, EType type);
~Bullet();
//Entity
void Update(float deltatime);
EType GetType();
Sprite* GetSprite();
Collider* GetCollider();
float GetX();
float GetY();
void SetVisibility(bool state);
bool IsVisible();
//Bullet
int GetDamage();
private:
//Entity
EType m_type;
Sprite* m_sprite;
Collider* m_collider;
float m_x;
float m_y;
bool m_visible;
//Bullet
int m_damage;
int m_speed;
int m_xDirection;
int m_yDirection;
};
EType is a enum which describes what type of Entity the object is. In this case the bullet has a variable for it because the bullet can be either a playerbullet E_PBULLET or a enemybullet E_EBULLET. |