The player character looks very lonely. She is ready to cause some mayhem, but there is nothing to shoot right now. Let's add some enemies to solve this problem:
- The enemies will be created using an enemy class; let's create a new class and call it Enemy.
- Just like the Hero class, the Enemy class will have a .h file and a .cpp file. In the Enemy.h file, add the following code:
#pragma once #include "SFML-2.5.1\include\SFML\Graphics.hpp" class Enemy { public: Enemy(); ~Enemy(); void init(std::string textureName, sf::Vector2f position,
float_speed); void update(float dt); sf::Sprite getSprite(); private: sf::Texture m_texture; sf::Sprite m_sprite; sf::Vector2f m_position; float m_speed; };
Here, the Enemy class, just like the Hero class, also has a constructor and destructor...