I'm trying to get a character to fire one of a number of weapons depending on the upgrades/selections they have and I'm not sure about how to set up the logic. How can you set it up so that your "fire weapon" command references some other event logic which itself will determine which weapon is selected and is fired? IE if the player has upgrade A then weapon X will fire, but if they have upgrade B then weapon Y will fire.
Develop games in your browser. Powerful, performant & highly capable.
Depends how complicated you want to make it.
Array of data would be recommended.
Functions to make it streamlined and mininimal.
But to explain in new user terms.
You will be comparing variables, either data stored in array or via variables
upgradea = 0 or 1
upgradeB = 0 or 1
Set up conditions
upgradeA = 1
upgradeB = 1
then weapon = 1
Thanks, Dutoit. Do you know of any good posts or tutorials on using arrays or functions in this manner?
Update: Found a tutorial on arrays.
I would look at any of the inventory tutorials. There is a great array tut with animals that shows a lot functionality.