fissh

termios terminal aquarium. demo at ssh://fish@kloet.net
Download | Log | Files | Refs

SeaMonster.h (883B)


      1 #pragma once
      2 #include "../assets/SeaMonsterAssets.h"
      3 #include "Entity.h"
      4 
      5 class SeaMonster : public Entity {
      6 private:
      7   static constexpr float SEAMONSTER_SPEED = 0.8f;
      8   static constexpr int WATER_SURFACE_OFFSET = 2;
      9 
     10   const std::vector<std::vector<std::string>> frames;
     11   const std::vector<std::string> &mask;
     12   const float speed;
     13 
     14   int current_frame_index = 0;
     15   int animation_counter = 0;
     16   mutable std::vector<std::string> current_image;
     17 
     18   static constexpr int ANIMATION_DELAY = 5;
     19 
     20   explicit SeaMonster(int asset_index);
     21   static int getRandomDirection();
     22 
     23 public:
     24   SeaMonster();
     25 
     26   void update() noexcept override;
     27   const std::vector<std::string> &getImage() const override;
     28   const std::vector<std::string> &getMask() const override { return mask; }
     29   char getDefaultColor() const noexcept override { return 'G'; }
     30 
     31   int getPreferredLayer() const noexcept override;
     32 };