#Help with code optimization. Simple text based game

41 messages · Page 1 of 1 (latest)

bitter oxide
#

So I created my second text based game in C++ to practice all my learnt skills, I used classes, and less functions. But I still need some review of my code and what to improve.

zinc sun
#

I dont speak French so I might get some stuff wrong but abilitiesDmg only has one value which you use for both abilities which is weird
bool yourTurn is also unused
You also keep track of yourHP but that has no effect on gameplay but maybe you wanna implement that later

glad vine
#

learn what a switch statement is next and try to implement

bitter oxide
bitter oxide
zinc sun
#

thats fair

bitter oxide
#

yea i should use it instead of if statements for the character and the abilities selection

zinc sun
#

I see plr.yourHP = plr.yourHP - plr.abilitiesDmg[0]; but Id expect something to happen when the player lost all his hp

bitter oxide
#

because u attack first jajajaja

#

and they all do 50 damage

#

But ill implement a dead function tomorrow

zinc sun
#

nice lmao

bitter oxide
#

Thank you so much for all the tips jajajaja

#

This server is amazing

#

the ascii art is weird

glad vine
#

should it not be like

bitter oxide
#

i put a minecraft sword jajajaja

glad vine
#

while (plr.enemyHP > 0 && plr.yourHp > 0)

bitter oxide
bitter oxide
glad vine
#

for your main while loop

bitter oxide
#

U mean the while loop in the mainHistory function?

bitter oxide
bitter oxide
#

yes ur right but u cant die rn in my game so thats why just enemyhp variable

#

but ill implement it tomorrow

#

btw is && the same as ||? @glad vine

glad vine
#

no

bitter oxide
#

whats &&

glad vine
#

&& is and

#

|| is or

bitter oxide
#

oh i thought they were both or

#

jajajajaja thanks

#

nice github btw