Skip to content
Snippets Groups Projects
Commit 997b385d authored by William Meaton's avatar William Meaton
Browse files

Stopped passing width and height up the chain to Entity, they were all identicle anyway

parent 2313946a
Branches
No related merge requests found
......@@ -9,7 +9,7 @@
#include "Creature.hpp"
//the Creature class holds the Health, Speed, damage etc of the creature
Creature::Creature(ofPoint position, float w, float h, float movementSpeed, float health, bool visible):Entity(position, w, h, visible), health(health), movementSpeed(movementSpeed){
Creature::Creature(ofPoint position, float movementSpeed, float health, bool visible):Entity(position, visible), health(health), movementSpeed(movementSpeed){
maxHealth = health;
}
//the creature takes damage
......
......@@ -18,7 +18,7 @@ protected:
float health, maxHealth;
float movementSpeed;
public:
Creature(ofPoint position, float w, float h, float movementSpeed, float health, bool visible);
Creature(ofPoint position, float movementSpeed, float health, bool visible);
bool isDead();
void takeDamage(float dmg);
void setHealth(float h);
......
......@@ -9,7 +9,7 @@
#include "Enemy.hpp"
Enemy::Enemy(ofPoint position, float movementSpeed, float health, bool visible, float attackDamage): Creature(position, SPRITE_SIZE, SPRITE_SIZE, movementSpeed, health, visible), attackDamage(attackDamage){
Enemy::Enemy(ofPoint position, float movementSpeed, float health, bool visible, float attackDamage): Creature(position, movementSpeed, health, visible), attackDamage(attackDamage){
}
float Enemy::getAttackDamage(){
......
......@@ -12,10 +12,10 @@
//the Entity class holds the position and visibility of the entity
Entity::Entity(ofPoint position, float w, float h, bool visible): visible(visible), position(position){
Entity::Entity(ofPoint position, bool visible): visible(visible), position(position){
//set the position of the entitiy
size.x = w;
size.y = h;
size.x = SPRITE_SIZE;
size.y = SPRITE_SIZE;
velocity.x = 0;
velocity.y = 0;
}
......
......@@ -20,7 +20,7 @@ protected:
public:
float gravityValue = 10;
ofPoint position, size, velocity;
Entity(ofPoint position, float w, float h, bool visible);
Entity(ofPoint position, bool visible);
bool onScreen();
bool worldCollide(float vx, float vy);
bool worldCollide(ofPoint velocity);
......
......@@ -8,4 +8,4 @@
#include "Item.hpp"
Item::Item(ofPoint position, bool visible) : Entity(position, SPRITE_SIZE, SPRITE_SIZE, visible){}
\ No newline at end of file
Item::Item(ofPoint position, bool visible) : Entity(position, visible){}
\ No newline at end of file
......@@ -9,7 +9,7 @@
#include "Player.hpp"
ofImage texture;
Player::Player(ofPoint position, float movementSpeed, float health, bool visible, vector<StandardBullet> &bullets) : Creature(position, SPRITE_SIZE, SPRITE_SIZE, movementSpeed, health, visible), bullets(bullets){
Player::Player(ofPoint position, float movementSpeed, float health, bool visible, vector<StandardBullet> &bullets) : Creature(position, movementSpeed, health, visible), bullets(bullets){
}
void Player::action(){
......
......@@ -7,7 +7,7 @@
//
#include "StandardBullet.hpp"
StandardBullet::StandardBullet(ofPoint position, ofPoint target, float movementSpeed, bool visible, float damage = 0) : Entity(position, SPRITE_SIZE, SPRITE_SIZE, visible), movementSpeed(movementSpeed), damage(damage), target(target){
StandardBullet::StandardBullet(ofPoint position, ofPoint target, float movementSpeed, bool visible, float damage = 0) : Entity(position, visible), movementSpeed(movementSpeed), damage(damage), target(target){
direction = (target - position);
direction.normalize();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment