diff --git a/.vscode/settings.json b/.vscode/settings.json index fba248f5..8bbfb646 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -88,6 +88,7 @@ "bitset": "cpp", "regex": "cpp", "valarray": "cpp", - "*.inc": "cpp" + "*.inc": "cpp", + "future": "cpp" } } \ No newline at end of file diff --git a/Crawler/Crawler b/Crawler/Crawler index 55b44be9..e95c06e7 100755 Binary files a/Crawler/Crawler and b/Crawler/Crawler differ diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 44c8df5e..0febed67 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -39,9 +39,7 @@ bool Crawler::OnUserCreate(){ InitializeLevel("assets/Campaigns/1_1.tmx",CAMPAIGN_1_1); - std::cout<<"Player loading."<(); - std::cout<<"Player loaded."<Load("assets/maps/"+tileset.GetData().ImageData.data["source"]); - std::cout<<"Done loading. "<>monster_list; @@ -795,7 +786,7 @@ void Crawler::LoadLevel(MapName map){ } SPAWNER_LIST.push_back(MonsterSpawner{{spawnData.ObjectData.GetFloat("x"),spawnData.ObjectData.GetFloat("y")},spawnerRadius*2,monster_list,spawnData.upperLevel}); } - std::cout<<"Spawner lists done."<foregroundTilesAdded,upperForegroundTilesAdded; for(int x=0;xupperLevel=false; //Assume player starts on lower level. player->SetPos(MAP_DATA[map].MapData.playerSpawnLocation); - std::cout<<"Player spawn info set."<>>&Crawler::GetZoneData(MapNam void Crawler::ChangePlayerClass(Class cl){ switch(cl){ case WARRIOR:{ - player.reset(new Warrior()); + player.reset(new Warrior(player.get())); }break; case THIEF:{ - player.reset(new Thief()); + player.reset(new Thief(player.get())); }break; case TRAPPER:{ - player.reset(new Trapper()); + player.reset(new Trapper(player.get())); }break; case RANGER:{ - player.reset(new Ranger()); + player.reset(new Ranger(player.get())); }break; case WIZARD:{ - player.reset(new Wizard()); + player.reset(new Wizard(player.get())); }break; case WITCH:{ - player.reset(new Witch()); + player.reset(new Witch(player.get())); }break; } + sig::Animation::SetupPlayerAnimations(); + GetPlayer()->InitializeClassAbilities(); GetPlayer()->UpdateIdleAnimation(DOWN); } diff --git a/Crawler/DEFINES.h b/Crawler/DEFINES.h index a2ec39cc..3a67326a 100644 --- a/Crawler/DEFINES.h +++ b/Crawler/DEFINES.h @@ -15,6 +15,8 @@ #define SETUP_CLASS(class) \ class::class(){InitializeClassAbilities();} \ +class::class(Player*player) \ + :Player::Player(player){} \ Class class::GetClass(){return cl;} \ std::string class::GetClassName(){return name;} \ Ability&class::GetRightClickAbility(){return rightClickAbility;}; \ diff --git a/Crawler/Monster.cpp b/Crawler/Monster.cpp index f557572c..252b4831 100644 --- a/Crawler/Monster.cpp +++ b/Crawler/Monster.cpp @@ -406,12 +406,9 @@ void Monster::PathAroundBehavior(float fElapsedTime){ }else{ if(pathIndex+1>=path.size()){ //We have reached the end of the path! - std::cout<<"Reached the end of the path."<GetPos()),vel(player->GetVelocity()),iframe_time(player->iframe_time),lastReleasedMovementKey(player->GetLastReleasedMovementKey()), + facingDirection(GetFacingDirection()){} + bool Player::SetX(float x){ vf2d newPos={x,pos.y}; vi2d tilePos=vi2d(newPos/24)*24; diff --git a/Crawler/Player.h b/Crawler/Player.h index be8c051f..8d2012fb 100644 --- a/Crawler/Player.h +++ b/Crawler/Player.h @@ -62,6 +62,10 @@ protected: float swordSwingTimer=0; public: Player(); + //So this is rather fascinating and only exists because we have the ability to change classes which means we need to initialize a class + //using a new object type... Because of that we'll take the pointer reference to the old object and copy some of its properties to this new + //one. It's hackish but it means we can reduce the amount of extra boilerplate when class changing...I don't know how to feel about this. + Player(Player*player); const static float GROUND_SLAM_SPIN_TIME; vf2d&GetPos(); float GetX(); @@ -125,6 +129,7 @@ struct Warrior:Player{ static Ability rightClickAbility,ability1,ability2,ability3,ability4; static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w; Warrior(); + Warrior(Player*player); Class GetClass()override; bool AutoAttack()override; void OnUpdate(float fElapsedTime)override; @@ -151,6 +156,7 @@ struct Thief:Player{ static Ability rightClickAbility,ability1,ability2,ability3,ability4; static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w; Thief(); + Thief(Player*player); Class GetClass()override; bool AutoAttack()override; void OnUpdate(float fElapsedTime)override; @@ -177,6 +183,7 @@ struct Ranger:Player{ static Ability rightClickAbility,ability1,ability2,ability3,ability4; static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w; Ranger(); + Ranger(Player*player); Class GetClass()override; bool AutoAttack()override; void OnUpdate(float fElapsedTime)override; @@ -203,6 +210,7 @@ struct Trapper:Player{ static Ability rightClickAbility,ability1,ability2,ability3,ability4; static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w; Trapper(); + Trapper(Player*player); Class GetClass()override; bool AutoAttack()override; void OnUpdate(float fElapsedTime)override; @@ -229,6 +237,7 @@ struct Wizard:Player{ static Ability rightClickAbility,ability1,ability2,ability3,ability4; static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w; Wizard(); + Wizard(Player*player); Class GetClass()override; bool AutoAttack()override; void OnUpdate(float fElapsedTime)override; @@ -255,6 +264,7 @@ struct Witch:Player{ static Ability rightClickAbility,ability1,ability2,ability3,ability4; static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w; Witch(); + Witch(Player*player); Class GetClass()override; bool AutoAttack()override; void OnUpdate(float fElapsedTime)override; diff --git a/Crawler/sig b/Crawler/sig index 07802e23..a36ba4ff 100755 --- a/Crawler/sig +++ b/Crawler/sig @@ -1,4 +1,4 @@ -export AUTO_UPDATE=false +export AUTO_UPDATE=true source utils/define.sh