Ok, so I am making an RPG game of sorts and I have ran into only one problem.
I am using a void for the battling system and i wanted to know if anyone knew a way to "die" from that void.
Suggestions?
You have a battle and based on the battle different outcomes will happen such as, damage produce, health lost, etc.
the way I thought of it is that
you would have it set up like this (there is more then one way to do it so you don't have to follow me to the letter here);
type Health ( if any parameters) { Conditions, deals with death}
type damage( if any parameters) {Conditions}
type death (if any parameters) {Conditions.. something like revival)
Battle ( if any parameters) { conditions of battle, damage function is then used to deal with damage, you health will then be effected by the damage that is produced meaning that you will used the health function}
A general rule of thumb is to keep function IOs to a minimum.
A good way of dealing with this is to have a structure or class that represents the characters status (health, magic, experience, etc.) and pass that into the battle function. Then return the resulting character status struct at the end.
You could pass the struct by reference and modify it directly or you can pass the data and then return the result. It doesn't really matter which method you use.