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;
|
||||
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()){
|
||||
std::cout<<cl<<std::endl;
|
||||
utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt");
|
||||
@ -212,15 +215,15 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
||||
};
|
||||
std::string staircaseDirection=GetPlayerStaircaseDirection();
|
||||
if(RightHeld()){
|
||||
player->SetX(player->GetX()+fElapsedTime*100*player->GetMoveSpdMult());
|
||||
player->movementVelocity.x=100;
|
||||
player->SetX(player->GetX()+fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||
player->movementVelocity.x="Player.MoveSpd"_F;
|
||||
if(staircaseDirection=="RIGHT"){
|
||||
player->SetY(player->GetY()-60*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=-60;
|
||||
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
|
||||
} else
|
||||
if(staircaseDirection=="LEFT"){
|
||||
player->SetY(player->GetY()+60*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=60;
|
||||
player->SetY(player->GetY()+"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y="Player.StaircaseClimbSpd"_F;
|
||||
}
|
||||
player->SetFacingDirection(RIGHT);
|
||||
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
||||
@ -229,15 +232,15 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
||||
setIdleAnimation=false;
|
||||
}
|
||||
if(LeftHeld()){
|
||||
player->SetX(player->GetX()-fElapsedTime*100*player->GetMoveSpdMult());
|
||||
player->movementVelocity.x=-100;
|
||||
player->SetX(player->GetX()-fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||
player->movementVelocity.x=-"Player.MoveSpd"_F;
|
||||
if(staircaseDirection=="RIGHT"){
|
||||
player->SetY(player->GetY()+60*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=60;
|
||||
player->SetY(player->GetY()+"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y="Player.StaircaseClimbSpd"_F;
|
||||
} else
|
||||
if(staircaseDirection=="LEFT"){
|
||||
player->SetY(player->GetY()-60*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=-60;
|
||||
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
|
||||
}
|
||||
if(setIdleAnimation){
|
||||
player->SetFacingDirection(LEFT);
|
||||
@ -248,8 +251,8 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
||||
setIdleAnimation=false;
|
||||
}
|
||||
if(UpHeld()){
|
||||
player->SetY(player->GetY()-fElapsedTime*100*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=-100*fElapsedTime;
|
||||
player->SetY(player->GetY()-fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=-"Player.MoveSpd"_F*fElapsedTime;
|
||||
if(setIdleAnimation){
|
||||
player->SetFacingDirection(UP);
|
||||
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
||||
@ -259,8 +262,8 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
||||
setIdleAnimation=false;
|
||||
}
|
||||
if(DownHeld()){
|
||||
player->SetY(player->GetY()+fElapsedTime*100*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y=100*fElapsedTime;
|
||||
player->SetY(player->GetY()+fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
|
||||
player->movementVelocity.y="Player.MoveSpd"_F*fElapsedTime;
|
||||
if(setIdleAnimation){
|
||||
player->SetFacingDirection(DOWN);
|
||||
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
|
||||
|
||||
@ -331,6 +331,7 @@
|
||||
<Text Include="assets\config\configuration.txt" />
|
||||
<Text Include="assets\config\gfx\gfx.txt" />
|
||||
<Text Include="assets\config\levels.txt" />
|
||||
<Text Include="assets\config\Player.txt" />
|
||||
<Text Include="NewClasses.txt" />
|
||||
<Text Include="InitialConcept.txt" />
|
||||
<Text Include="Slime_King_Encounter.txt" />
|
||||
|
||||
@ -251,6 +251,9 @@
|
||||
<Text Include="assets\config\classes\Wizard.txt">
|
||||
<Filter>Configurations\Classes</Filter>
|
||||
</Text>
|
||||
<Text Include="assets\config\Player.txt">
|
||||
<Filter>Configurations</Filter>
|
||||
</Text>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="assets\heart.ico">
|
||||
|
||||
@ -27,9 +27,9 @@ struct Player{
|
||||
friend class Wizard;
|
||||
friend class Witch;
|
||||
private:
|
||||
int hp=100,maxhp=hp;
|
||||
int mana=100,maxmana=mana;
|
||||
int atk=10;
|
||||
int hp="Player.BaseHealth"_I,maxhp=hp;
|
||||
int mana="Player.BaseMana"_I,maxmana=mana;
|
||||
int atk="Player.BaseAtk"_I;
|
||||
vf2d pos;
|
||||
float z=0;
|
||||
float moveSpd=1.0f;
|
||||
@ -70,7 +70,7 @@ protected:
|
||||
//Returns true if the move was valid and successful.
|
||||
bool SetPos(vf2d pos);
|
||||
void Knockback(vf2d vel);
|
||||
float friction=400;
|
||||
float friction="Player.Friction"_F;
|
||||
float attack_cooldown_timer=0;
|
||||
float iframe_time=0;
|
||||
float teleportAnimationTimer=0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 959
|
||||
#define VERSION_BUILD 962
|
||||
|
||||
#define stringify(a) stringify_(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_config = levels.txt
|
||||
|
||||
# Player Properties Loading Config
|
||||
player_config = Player.txt
|
||||
|
||||
# Path to class configuration files
|
||||
class_directory = classes/
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user