diff --git a/Enemy.cpp b/Enemy.cpp index a236d5d..01a36f8 100644 --- a/Enemy.cpp +++ b/Enemy.cpp @@ -1,6 +1,6 @@ #include "Enemy.h" -Enemy::Enemy(Point center_pos, int _type) : type(_type), mov(center_pos) +Enemy::Enemy(Point center_pos, int _type) : type(_type), mov(center_pos + Point{.x = 0, .y = 5}) { max_hp = get_hp(_type); hp = max_hp; diff --git a/Enemy.h b/Enemy.h index 8dac13c..1e28488 100644 --- a/Enemy.h +++ b/Enemy.h @@ -10,16 +10,19 @@ struct Enemy static constexpr int get_hp(int type) { if (type == 0)return 20; - return 35; + if (type == 1)return 40; + return 30; } static constexpr Size get_sz(int type) { if (type == 0)return Size {.w = 41, .h = 34}; + if (type == 1)return Size {.w = 28, .h = 38}; return Size {2,2}; } static constexpr int get_speed(int type) { if (type == 0)return 160; + if (type == 1)return 80; return 80; } diff --git a/LiveObjSprite.h b/LiveObjSprite.h index 70cb96d..52eb81c 100644 --- a/LiveObjSprite.h +++ b/LiveObjSprite.h @@ -21,14 +21,14 @@ enum class E_LiveObjType struct LiveObjSprite { - LiveObjSprite(E_LiveObjType must_enemy, int type, int move_frames, int attack_frames, int take_hit_frames) : spr_states() + LiveObjSprite(E_LiveObjType must_enemy, int type, int move_frames, int attack_frames, int take_hit_frames, int ms_speed) : spr_states() { if (must_enemy != E_LiveObjType::Enemy)error("must enemy. for character use another constructor"); lo_type = must_enemy; cur_dir = std::rand() % 2 ? E_Dir::LEFT : E_Dir::RIGHT; std::string path_0 = "../resources/enemies/" + std::to_string(type) + "/"; - spr_states.insert({E_LiveObjState::Idle, std::map{}}).first->second.insert({E_Dir::RIGHT, Sprite(path_0 + "move.png", move_frames)}); - spr_states.insert({E_LiveObjState::Attack, std::map{}}).first->second.insert({E_Dir::RIGHT, Sprite(path_0 + "attack.png", attack_frames)}); + spr_states.insert({E_LiveObjState::Idle, std::map{}}).first->second.insert({E_Dir::RIGHT, Sprite(path_0 + "move.png", move_frames, ms_speed)}); + spr_states.insert({E_LiveObjState::Attack, std::map{}}).first->second.insert({E_Dir::RIGHT, Sprite(path_0 + "attack.png", attack_frames, ms_speed)}); spr_states.insert({E_LiveObjState::TakeHit, std::map{}}).first->second.insert({E_Dir::RIGHT, Sprite(path_0 + "take_hit.png", take_hit_frames)}); //SetCurSprite(); } diff --git a/Player.h b/Player.h index 901ad66..e5024c9 100644 --- a/Player.h +++ b/Player.h @@ -16,7 +16,7 @@ private: static Player *player_getter; { Kill, EmptyStay, - }; + }; static Player &Get() { return *player_getter; } diff --git a/SpriteManager.h b/SpriteManager.h index ede2ada..406179c 100644 --- a/SpriteManager.h +++ b/SpriteManager.h @@ -37,22 +37,33 @@ struct SpriteManager static constexpr int e_get_move_frames(int type) { if (type == 0)return 8; + if (type == 1)return 8; return 1; } static constexpr int e_get_attack_frames(int type) { if (type == 0)return 8; + if (type == 1)return 8; return 1; } static constexpr int e_get_take_hit_frames(int type) { if (type == 0)return 4; + if (type == 1)return 4; + return 1; + } + static constexpr int e_get_spr_speed(int type) + { + if (type == 0)return 125; + if (type == 1)return 190; return 1; } SpriteManager() : enemy_spr(), hp_imgs(), doors() { - for (int _type = 0; _type < 1; _type++) - enemy_spr.emplace_back(E_LiveObjType::Enemy, _type, e_get_move_frames(_type), e_get_attack_frames(_type), e_get_take_hit_frames(_type)); + for (int _type = 0; _type < 2; _type++) + enemy_spr.emplace_back(E_LiveObjType::Enemy, _type, + e_get_move_frames(_type), e_get_attack_frames(_type), + e_get_take_hit_frames(_type), e_get_spr_speed(_type)); int sz = HP_SZ; Image hp_img {sz,sz,4}; diff --git a/maps/F.txt b/maps/F.txt index ebd0bea..a89c109 100644 --- a/maps/F.txt +++ b/maps/F.txt @@ -19,8 +19,8 @@ O. ..E.....#.........#... .....O ###########O#################### z- -E: 0, 0, 0, 0, 0, 0, 0, 0 -/1, 0, 1, 1, 1, 0, 0, 0 +/E: 0, 0, 0, 0, 0, 0, 0, 0 +E: 1, 0, 1, 1, 1, 0, 0, 0 I: 2, 1, 2, 3, 0, 0, 0, 1, 1 /I: - rarity of Items in the same order as they stay on map diff --git a/resources/enemies/1/attack.png b/resources/enemies/1/attack.png new file mode 100644 index 0000000..926dd0a Binary files /dev/null and b/resources/enemies/1/attack.png differ diff --git a/resources/enemies/1/move.png b/resources/enemies/1/move.png new file mode 100644 index 0000000..20b5bc4 Binary files /dev/null and b/resources/enemies/1/move.png differ diff --git a/resources/enemies/1/take_hit.png b/resources/enemies/1/take_hit.png new file mode 100644 index 0000000..830ce15 Binary files /dev/null and b/resources/enemies/1/take_hit.png differ