Player configuration file implemented.
This commit is contained in:
parent
b2d363cdef
commit
1c2106135d
@ -49,6 +49,9 @@ Crawler::Crawler()
|
|||||||
std::string MAP_CONFIG = CONFIG_PATH + "map_config"_S;
|
std::string MAP_CONFIG = CONFIG_PATH + "map_config"_S;
|
||||||
utils::datafile::Read(DATA,MAP_CONFIG);
|
utils::datafile::Read(DATA,MAP_CONFIG);
|
||||||
|
|
||||||
|
std::string PLAYER_CONFIG = CONFIG_PATH + "player_config"_S;
|
||||||
|
utils::datafile::Read(DATA,PLAYER_CONFIG);
|
||||||
|
|
||||||
for(std::string&cl:DATA.GetProperty("class_list").GetValues()){
|
for(std::string&cl:DATA.GetProperty("class_list").GetValues()){
|
||||||
std::cout<<cl<<std::endl;
|
std::cout<<cl<<std::endl;
|
||||||
utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt");
|
utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt");
|
||||||
@ -212,15 +215,15 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
|||||||
};
|
};
|
||||||
std::string staircaseDirection=GetPlayerStaircaseDirection();
|
std::string staircaseDirection=GetPlayerStaircaseDirection();
|
||||||
if(RightHeld()){
|
if(RightHeld()){
|
||||||
player->SetX(player->GetX()+fElapsedTime*100*player->GetMoveSpdMult());
|
player->SetX(player->GetX()+fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.x=100;
|
player->movementVelocity.x="Player.MoveSpd"_F;
|
||||||
if(staircaseDirection=="RIGHT"){
|
if(staircaseDirection=="RIGHT"){
|
||||||
player->SetY(player->GetY()-60*fElapsedTime*player->GetMoveSpdMult());
|
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.y=-60;
|
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
|
||||||
} else
|
} else
|
||||||
if(staircaseDirection=="LEFT"){
|
if(staircaseDirection=="LEFT"){
|
||||||
player->SetY(player->GetY()+60*fElapsedTime*player->GetMoveSpdMult());
|
player->SetY(player->GetY()+"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.y=60;
|
player->movementVelocity.y="Player.StaircaseClimbSpd"_F;
|
||||||
}
|
}
|
||||||
player->SetFacingDirection(RIGHT);
|
player->SetFacingDirection(RIGHT);
|
||||||
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
||||||
@ -229,15 +232,15 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
|||||||
setIdleAnimation=false;
|
setIdleAnimation=false;
|
||||||
}
|
}
|
||||||
if(LeftHeld()){
|
if(LeftHeld()){
|
||||||
player->SetX(player->GetX()-fElapsedTime*100*player->GetMoveSpdMult());
|
player->SetX(player->GetX()-fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.x=-100;
|
player->movementVelocity.x=-"Player.MoveSpd"_F;
|
||||||
if(staircaseDirection=="RIGHT"){
|
if(staircaseDirection=="RIGHT"){
|
||||||
player->SetY(player->GetY()+60*fElapsedTime*player->GetMoveSpdMult());
|
player->SetY(player->GetY()+"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.y=60;
|
player->movementVelocity.y="Player.StaircaseClimbSpd"_F;
|
||||||
} else
|
} else
|
||||||
if(staircaseDirection=="LEFT"){
|
if(staircaseDirection=="LEFT"){
|
||||||
player->SetY(player->GetY()-60*fElapsedTime*player->GetMoveSpdMult());
|
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.y=-60;
|
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
|
||||||
}
|
}
|
||||||
if(setIdleAnimation){
|
if(setIdleAnimation){
|
||||||
player->SetFacingDirection(LEFT);
|
player->SetFacingDirection(LEFT);
|
||||||
@ -248,8 +251,8 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
|||||||
setIdleAnimation=false;
|
setIdleAnimation=false;
|
||||||
}
|
}
|
||||||
if(UpHeld()){
|
if(UpHeld()){
|
||||||
player->SetY(player->GetY()-fElapsedTime*100*player->GetMoveSpdMult());
|
player->SetY(player->GetY()-fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.y=-100*fElapsedTime;
|
player->movementVelocity.y=-"Player.MoveSpd"_F*fElapsedTime;
|
||||||
if(setIdleAnimation){
|
if(setIdleAnimation){
|
||||||
player->SetFacingDirection(UP);
|
player->SetFacingDirection(UP);
|
||||||
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
||||||
@ -259,8 +262,8 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
|||||||
setIdleAnimation=false;
|
setIdleAnimation=false;
|
||||||
}
|
}
|
||||||
if(DownHeld()){
|
if(DownHeld()){
|
||||||
player->SetY(player->GetY()+fElapsedTime*100*player->GetMoveSpdMult());
|
player->SetY(player->GetY()+fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||||
player->movementVelocity.y=100*fElapsedTime;
|
player->movementVelocity.y="Player.MoveSpd"_F*fElapsedTime;
|
||||||
if(setIdleAnimation){
|
if(setIdleAnimation){
|
||||||
player->SetFacingDirection(DOWN);
|
player->SetFacingDirection(DOWN);
|
||||||
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
||||||
|
@ -331,6 +331,7 @@
|
|||||||
<Text Include="assets\config\configuration.txt" />
|
<Text Include="assets\config\configuration.txt" />
|
||||||
<Text Include="assets\config\gfx\gfx.txt" />
|
<Text Include="assets\config\gfx\gfx.txt" />
|
||||||
<Text Include="assets\config\levels.txt" />
|
<Text Include="assets\config\levels.txt" />
|
||||||
|
<Text Include="assets\config\Player.txt" />
|
||||||
<Text Include="NewClasses.txt" />
|
<Text Include="NewClasses.txt" />
|
||||||
<Text Include="InitialConcept.txt" />
|
<Text Include="InitialConcept.txt" />
|
||||||
<Text Include="Slime_King_Encounter.txt" />
|
<Text Include="Slime_King_Encounter.txt" />
|
||||||
|
@ -251,6 +251,9 @@
|
|||||||
<Text Include="assets\config\classes\Wizard.txt">
|
<Text Include="assets\config\classes\Wizard.txt">
|
||||||
<Filter>Configurations\Classes</Filter>
|
<Filter>Configurations\Classes</Filter>
|
||||||
</Text>
|
</Text>
|
||||||
|
<Text Include="assets\config\Player.txt">
|
||||||
|
<Filter>Configurations</Filter>
|
||||||
|
</Text>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="assets\heart.ico">
|
<Image Include="assets\heart.ico">
|
||||||
|
@ -27,9 +27,9 @@ struct Player{
|
|||||||
friend class Wizard;
|
friend class Wizard;
|
||||||
friend class Witch;
|
friend class Witch;
|
||||||
private:
|
private:
|
||||||
int hp=100,maxhp=hp;
|
int hp="Player.BaseHealth"_I,maxhp=hp;
|
||||||
int mana=100,maxmana=mana;
|
int mana="Player.BaseMana"_I,maxmana=mana;
|
||||||
int atk=10;
|
int atk="Player.BaseAtk"_I;
|
||||||
vf2d pos;
|
vf2d pos;
|
||||||
float z=0;
|
float z=0;
|
||||||
float moveSpd=1.0f;
|
float moveSpd=1.0f;
|
||||||
@ -70,7 +70,7 @@ protected:
|
|||||||
//Returns true if the move was valid and successful.
|
//Returns true if the move was valid and successful.
|
||||||
bool SetPos(vf2d pos);
|
bool SetPos(vf2d pos);
|
||||||
void Knockback(vf2d vel);
|
void Knockback(vf2d vel);
|
||||||
float friction=400;
|
float friction="Player.Friction"_F;
|
||||||
float attack_cooldown_timer=0;
|
float attack_cooldown_timer=0;
|
||||||
float iframe_time=0;
|
float iframe_time=0;
|
||||||
float teleportAnimationTimer=0;
|
float teleportAnimationTimer=0;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 959
|
#define VERSION_BUILD 962
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
14
Crawler/assets/config/Player.txt
Normal file
14
Crawler/assets/config/Player.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Player
|
||||||
|
{
|
||||||
|
BaseHealth = 1000
|
||||||
|
BaseMana = 100
|
||||||
|
MoveSpd = 100
|
||||||
|
|
||||||
|
BaseAtk = 10
|
||||||
|
|
||||||
|
# Amount of spd to increase/decrease vertically as you climb staircases
|
||||||
|
StaircaseClimbSpd = 60
|
||||||
|
|
||||||
|
# How much speed the player loses while no momentum is being added.
|
||||||
|
Friction = 400
|
||||||
|
}
|
@ -9,6 +9,9 @@ gfx_config = gfx/gfx.txt
|
|||||||
# Map Files Loading Config
|
# Map Files Loading Config
|
||||||
map_config = levels.txt
|
map_config = levels.txt
|
||||||
|
|
||||||
|
# Player Properties Loading Config
|
||||||
|
player_config = Player.txt
|
||||||
|
|
||||||
# Path to class configuration files
|
# Path to class configuration files
|
||||||
class_directory = classes/
|
class_directory = classes/
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user