hey everyone. I've been about to add some form of code so the ship in the space game can "sustain" damage.
this is what I've come up with. In pseudo code only :)
just want to see if my approach is ok, or if its done some other way in general.
now in my code where my ships speed is modified, im thinking.
so as the engine health drops, i can drop the max capability of the ship based directly on that.
so like if engine_health out of 100 is 70. probably reduce 1/4 of the speed the ship is capable of.
would this constitute a proper approach? or a newbie's only way he could conceive to do something.
also for something such as invisibility. this is my simple approach.
now my thing is that will include lots of booleans basically. is it wrong or bad to have a lot of boolean variables? variables that you are relying on simply to check if something is true or false? Or is it normal for a game to have a lot, because the game constantly has to be checking for things in order to behave correctly, or behave the way you want it to.
In this case:
"dont fire on the playe if his invisibility = true."
is my approachs sound? or will i run into trouble?
this is what I've come up with. In pseudo code only :)
just want to see if my approach is ok, or if its done some other way in general.
ok i have a field in tplayership. engine_health on being hit check status of shields. if down '5 could be a variable that changes with rand, with a specified inbetween range so it doesn't ge too big. engine_health :- 5
now in my code where my ships speed is modified, im thinking.
if engine_health < (certain number) 'down from what the max speed is, if 3, then say 2.5 then ship.max_speed = (reduced speed here)
so as the engine health drops, i can drop the max capability of the ship based directly on that.
so like if engine_health out of 100 is 70. probably reduce 1/4 of the speed the ship is capable of.
would this constitute a proper approach? or a newbie's only way he could conceive to do something.
also for something such as invisibility. this is my simple approach.
'When AI is firing at player it check player invisibilty. 'this is the first statement of the AI "fire" code. so it checks whether player is invisible or not up front. If it evaluates to true, the code won't run. If false, then the player can be seen so it runs. or "fires at the player" if invisible = false
now my thing is that will include lots of booleans basically. is it wrong or bad to have a lot of boolean variables? variables that you are relying on simply to check if something is true or false? Or is it normal for a game to have a lot, because the game constantly has to be checking for things in order to behave correctly, or behave the way you want it to.
In this case:
"dont fire on the playe if his invisibility = true."
is my approachs sound? or will i run into trouble?