generated from sigonasr2/CPlusPlusProjectTemplate
Implemented ATB bars
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
154cd4e067
commit
5252d1ad70
Binary file not shown.
BIN
assets/atbbar_back.png
Normal file
BIN
assets/atbbar_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 572 B |
BIN
assets/atbbar_front.png
Normal file
BIN
assets/atbbar_front.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 569 B |
@ -81,7 +81,6 @@ OBJECT224.000000;256.000000;8
|
||||
OBJECT192.000000;256.000000;8
|
||||
OBJECT160.000000;256.000000;8
|
||||
ENCOUNTER64.000000;512.000000;90;2
|
||||
ENCOUNTER64.000000;64.000000;35;1
|
||||
ENCOUNTER64.000000;256.000000;100;1
|
||||
ENCOUNTER64.000000;256.000000;50;1
|
||||
ENCOUNTER192.000000;352.000000;25;1
|
||||
ENCOUNTER320.000000;288.000000;25;2
|
||||
ENCOUNTER128.000000;0.000000;25;2
|
52
main.cpp
52
main.cpp
@ -393,6 +393,9 @@ public:
|
||||
int player_rollhp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
|
||||
int player_rollpp_display[4][3] = {{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
|
||||
int SELECTED_TEST_TARGET=0;
|
||||
int BATTLE_TARGET=-99; //Negative numbers for players and positive numbers for enemy targets.
|
||||
int CURRENT_TURN=-99; //Who's turn we are enacting.
|
||||
|
||||
|
||||
|
||||
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
||||
@ -570,7 +573,7 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
case BattleState::WAIT:{
|
||||
for (int i=0;i<PARTY_MEMBER_COUNT;i++) {
|
||||
Entity*member=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]];
|
||||
if (member->HP>member->targetHP) {
|
||||
if (member->HP>std::clamp(member->targetHP,0,member->targetHP)) {
|
||||
if (player_rollhp_counter[i][0]<=0) {
|
||||
player_rollhp_display[i][0]--;
|
||||
player_rollhp_counter[i][0]=13;
|
||||
@ -589,7 +592,14 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
}
|
||||
}
|
||||
if (player_rollhp_counter[i][0]>0) {
|
||||
player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED;
|
||||
if (member->targetHP<-member->maxHP) {
|
||||
player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->targetHP)/10;
|
||||
} else
|
||||
if (member->targetHP<0) {
|
||||
player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED+(member->maxHP-member->targetHP)/20;
|
||||
} else {
|
||||
player_rollhp_counter[i][0]-=HEALTH_ROLLING_SPEED;
|
||||
}
|
||||
}
|
||||
if (player_rollhp_counter[i][1]>0) {
|
||||
player_rollhp_counter[i][1]--;
|
||||
@ -646,6 +656,34 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
}
|
||||
}
|
||||
}
|
||||
bool done=false;
|
||||
for (int i=0;i<4;i++) {
|
||||
if (PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb>=1000) {
|
||||
printf("%s ready.\n",PARTY_MEMBER_OBJ[i]->name.c_str());
|
||||
CURRENT_TURN=-i;
|
||||
GAME_STATE=BattleState::SELECT_ACTION;
|
||||
done=true;
|
||||
break;
|
||||
} else {
|
||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->atb+=PARTY_MEMBER_STATS[PARTY_MEMBER_ID[i]]->speed;
|
||||
}
|
||||
}
|
||||
if (!done) {
|
||||
for (int i=0;i<BATTLE_ENCOUNTER->objs.size();i++) {
|
||||
if (BATTLE_ENCOUNTER->objs[i]->atb>=1000) {
|
||||
printf("%s (%d) ready.\n",BATTLE_ENCOUNTER->objs[i]->obj->name.c_str(),i);
|
||||
CURRENT_TURN=i;
|
||||
GAME_STATE=BattleState::SELECT_ACTION;
|
||||
done=true;
|
||||
break;
|
||||
} else {
|
||||
BATTLE_ENCOUNTER->objs[i]->atb+=BATTLE_ENCOUNTER->objs[i]->speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case BattleState::SELECT_ACTION:{
|
||||
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@ -1012,6 +1050,12 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
if (GetKey(PGDN).bPressed) {
|
||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=std::clamp(PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP-10,0,PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->maxHP);
|
||||
}
|
||||
if (GetKey(DEL).bPressed) {
|
||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=-50;
|
||||
}
|
||||
if (GetKey(END).bPressed) {
|
||||
PARTY_MEMBER_STATS[PARTY_MEMBER_ID[SELECTED_TEST_TARGET]]->targetHP=-350;
|
||||
}
|
||||
}
|
||||
|
||||
switch (GAME_STATE) {
|
||||
@ -1257,6 +1301,8 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
const olc::vi2d box = {(128-32*PARTY_MEMBER_COUNT)+i*64,160};
|
||||
drawCheckerboardBox(box,{59,59},olc::Pixel(180,159,194),olc::Pixel(200,179,214),{6,6});
|
||||
DrawStringDecal({(float)(box.x+6),(float)(box.y+6)},obj->name,olc::BLACK);
|
||||
DrawPartialDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_back.png"],{0,0},{member->atb/1000.0*SPRITES["atbbar_back.png"]->sprite->width,SPRITES["atbbar_back.png"]->sprite->height});
|
||||
DrawDecal({(float)(box.x+4),(float)(box.y+5+8+2)},SPRITES["atbbar_front.png"]);
|
||||
const olc::vi2d hpTextPos = {box.x+5,box.y+25};
|
||||
for (int x=-1;x<=1;x++) {
|
||||
for (int y=-1;y<=1;y++) {
|
||||
@ -1613,6 +1659,8 @@ goes on a very long time, I hope you can understand this is only for testing pur
|
||||
CreateSprite("terrainmap.png");
|
||||
CreateSprite("additionalFont.png");
|
||||
CreateSprite("rollingcounter.png");
|
||||
CreateSprite("atbbar_back.png");
|
||||
CreateSprite("atbbar_front.png");
|
||||
}
|
||||
|
||||
void SetupObjectInfo() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user