53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#ifndef ENEMY_HPP
|
|
#define ENEMY_HPP
|
|
|
|
#include <godot_cpp/classes/rigid_body2d.hpp>
|
|
#include <godot_cpp/classes/physics_direct_body_state2d.hpp>
|
|
|
|
#include "Bullet.hpp"
|
|
|
|
namespace godot {
|
|
class Enemy : public RigidBody2D {
|
|
GDCLASS(Enemy, RigidBody2D)
|
|
|
|
private:
|
|
int Health = 5;
|
|
int Speed = 250;
|
|
Vector2 Direction = Vector2(-1, 0);
|
|
int ScoreAmount = 200;
|
|
|
|
bool IsShooting = false;
|
|
double FireRate = 1;
|
|
double FireRateTimer = 0;
|
|
Vector2 BulletDirection = Vector2(-1, 0);
|
|
|
|
protected:
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
Enemy();
|
|
~Enemy();
|
|
|
|
void _integrate_forces(PhysicsDirectBodyState2D* state) override;
|
|
void _physics_process(double delta) override;
|
|
|
|
// Getters and Setters
|
|
int GetHealth() const;
|
|
int GetSpeed() const;
|
|
Vector2 GetDirection() const;
|
|
int GetScoreAmount() const;
|
|
bool GetIsShooting() const;
|
|
double GetFireRate() const;
|
|
double GetBulletDirection() const;
|
|
|
|
void SetHealth(const int health);
|
|
void SetSpeed(const int speed);
|
|
void SetDirection(const Vector2 direction);
|
|
void SetScoreAmount(const int scoreAmount);
|
|
void SetIsShooting(const bool isShooting);
|
|
void SetFireRate(const double fireRate);
|
|
void SetBulletDirection(const double bulletDirection);
|
|
};
|
|
};
|
|
|
|
#endif
|