Define and setup internal class attributes.

pull/28/head
sigonasr2 2 years ago
parent e090bc775d
commit 21368f6f95
  1. 46
      Crawler/Class.cpp
  2. 12
      Crawler/Class.h
  3. 2
      Crawler/Crawler.cpp
  4. 2
      Crawler/Crawler.vcxproj
  5. 6
      Crawler/Crawler.vcxproj.filters
  6. 1
      Crawler/DEFINES.h
  7. 7
      Crawler/NewClasses.txt
  8. 14
      Crawler/Player.cpp
  9. 3
      Crawler/Player.h

@ -0,0 +1,46 @@
#include "Class.h"
std::map<Class,ClassData>CLASS_DATA={
{WARRIOR,{
"Warrior",WARRIOR,
{"Block",15,VERY_DARK_BLUE,DARK_BLUE},
{"Battlecry",12},
{"Ground Slam",15},
{"Sonic Slash",40}
}},
{THIEF,{
"Thief",THIEF,
{"???",15,VERY_DARK_BLUE,DARK_BLUE},
{"???",12},
{"???",15},
{"???",40}
}},
{RANGER,{
"Ranger",RANGER,
{"Retreat",7,VERY_DARK_BLUE,DARK_BLUE},
{"Rapid Fire",12},
{"Charged Shot",15},
{"Multishot",25}
}},
{BARD,{
"Bard",BARD,
{"???",7,VERY_DARK_BLUE,DARK_BLUE},
{"???",12},
{"???",15},
{"???",25}
}},
{WIZARD,{
"Wizard",WIZARD,
{"Teleport",8,VERY_DARK_BLUE,DARK_BLUE},
{"Firebolt",6},
{"Lightning Bolt",6},
{"Meteor",40}
}},
{WITCH,{
"Witch",WITCH,
{"???",8,VERY_DARK_BLUE,DARK_BLUE},
{"???",6},
{"???",6},
{"???",40}
}},
};

@ -0,0 +1,12 @@
#pragma once
#include "Ability.h"
#include "olcPixelGameEngine.h"
enum Class{
WARRIOR,THIEF,RANGER,BARD,WIZARD,WITCH
};
struct ClassData{
std::string name;
Class cl;
Ability rightClickAbility,ability1,ability2,ability3;
};

@ -4,6 +4,7 @@
#include "DamageNumber.h" #include "DamageNumber.h"
#include "Bullet.h" #include "Bullet.h"
#include "Ability.h" #include "Ability.h"
#include "Class.h"
#include "DEFINES.h" #include "DEFINES.h"
//192x192 //192x192
@ -55,6 +56,7 @@ bool Crawler::OnUserCreate(){
player.AddAnimation(AnimationState::SWINGSWORD_W); player.AddAnimation(AnimationState::SWINGSWORD_W);
view=TileTransformedView{GetScreenSize(),{1,1}}; view=TileTransformedView{GetScreenSize(),{1,1}};
player.SetClass(WARRIOR);
player.SetPos({4*24,4*24}); player.SetPos({4*24,4*24});
player.UpdateAnimation(AnimationState::IDLE_S); player.UpdateAnimation(AnimationState::IDLE_S);

@ -132,6 +132,7 @@
<ClInclude Include="Ability.h" /> <ClInclude Include="Ability.h" />
<ClInclude Include="Animation.h" /> <ClInclude Include="Animation.h" />
<ClInclude Include="Bullet.h" /> <ClInclude Include="Bullet.h" />
<ClInclude Include="Class.h" />
<ClInclude Include="Crawler.h" /> <ClInclude Include="Crawler.h" />
<ClInclude Include="DamageNumber.h" /> <ClInclude Include="DamageNumber.h" />
<ClInclude Include="DEFINES.h" /> <ClInclude Include="DEFINES.h" />
@ -148,6 +149,7 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="Ability.cpp" /> <ClCompile Include="Ability.cpp" />
<ClCompile Include="Bullet.cpp" /> <ClCompile Include="Bullet.cpp" />
<ClCompile Include="Class.cpp" />
<ClCompile Include="Crawler.cpp" /> <ClCompile Include="Crawler.cpp" />
<ClCompile Include="DamageNumber.cpp" /> <ClCompile Include="DamageNumber.cpp" />
<ClCompile Include="Effect.cpp" /> <ClCompile Include="Effect.cpp" />

@ -60,6 +60,9 @@
<ClInclude Include="Ability.h"> <ClInclude Include="Ability.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Class.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Player.cpp"> <ClCompile Include="Player.cpp">
@ -89,6 +92,9 @@
<ClCompile Include="Ability.cpp"> <ClCompile Include="Ability.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Class.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="cpp.hint" /> <None Include="cpp.hint" />

@ -6,3 +6,4 @@
#define INCLUDE_game extern Crawler*game; #define INCLUDE_game extern Crawler*game;
#define INCLUDE_MONSTER_DATA extern std::map<MonsterName,MonsterData>MONSTER_DATA; #define INCLUDE_MONSTER_DATA extern std::map<MonsterName,MonsterData>MONSTER_DATA;
#define INCLUDE_BULLET_LIST extern std::vector<Bullet>BULLET_LIST; #define INCLUDE_BULLET_LIST extern std::vector<Bullet>BULLET_LIST;
#define INCLUDE_CLASS_DATA extern std::map<Class,ClassData>CLASS_DATA;

@ -22,6 +22,8 @@ the Battlecry slow is primarly ment to make it easier to catch up with range uni
Ranger Ranger
Ranger und bard shoot arrow. little higher cooldown to balance range advantage. like 0.6 maybe.
Rightclick - Retreat Rightclick - Retreat
Backwardsjump Backwardsjump
leap 250 Range backwards. leap 250 Range backwards.
@ -42,7 +44,12 @@ every arrow normal autohit dmg. (can be used as shotgun against large foes for 6
25 sec. cd 25 sec. cd
55 Mana 55 Mana
Wizard Wizard
Wizard and witch have different attacks. Both Probably around 0.85 sec cd. Skill cooldowns will be lower to balance that out.
Wizard energy bolts that are just like arrows normal projectiles
Rightclick - Teleport Rightclick - Teleport
Teleports to a location within 650 Range Teleports to a location within 650 Range
cd 8 sec. cd 8 sec.

@ -9,16 +9,20 @@ INCLUDE_MONSTER_LIST
INCLUDE_ANIMATION_DATA INCLUDE_ANIMATION_DATA
INCLUDE_SPAWNER_LIST INCLUDE_SPAWNER_LIST
INCLUDE_DAMAGENUMBER_LIST INCLUDE_DAMAGENUMBER_LIST
INCLUDE_CLASS_DATA
INCLUDE_game INCLUDE_game
const float Player::GROUND_SLAM_SPIN_TIME=0.6f; const float Player::GROUND_SLAM_SPIN_TIME=0.6f;
Player::Player(): Player::Player():
state(State::NORMAL),lastReleasedMovementKey(DOWN),facingDirection(DOWN), state(State::NORMAL),lastReleasedMovementKey(DOWN),facingDirection(DOWN){}
rightClickAbility("Block",15,VERY_DARK_BLUE,DARK_BLUE),
ability1("Battlecry",12), void Player::SetClass(Class cl){
ability2("Ground Slam",15), this->cl=CLASS_DATA[cl].cl;
ability3("Sonic Slash",40){ rightClickAbility=CLASS_DATA[cl].rightClickAbility;
ability1=CLASS_DATA[cl].ability1;
ability2=CLASS_DATA[cl].ability2;
ability3=CLASS_DATA[cl].ability3;
} }
void Player::SetX(float x){ void Player::SetX(float x){

@ -4,10 +4,12 @@
#include "Monster.h" #include "Monster.h"
#include "State.h" #include "State.h"
#include "Ability.h" #include "Ability.h"
#include "Class.h"
struct Player{ struct Player{
friend class Crawler; friend class Crawler;
private: private:
Class cl=WARRIOR;
int hp=100,maxhp=hp; int hp=100,maxhp=hp;
int atk=10; int atk=10;
vf2d pos; vf2d pos;
@ -42,6 +44,7 @@ private:
void SetY(float y); void SetY(float y);
void SetZ(float z); void SetZ(float z);
void SetPos(vf2d pos); void SetPos(vf2d pos);
void SetClass(Class cl);
protected: protected:
public: public:
Player(); Player();

Loading…
Cancel
Save