Quantcast
Channel: Questions in topic: "static variables"
Viewing all articles
Browse latest Browse all 84

Design Advice: Power Up System (static variables?)

$
0
0
hey there, I have a game in progress in which the player can fly around in 3d space and shoot weapons. I have various variables for the player like: movement speed, rate of fire, damage, hit points etc. I would like to create a system of powerups to modify these variables as the player's score increases. I have a static variable for score in a game object that manages global stats. The player variables are on various game objects as children of the main player object. I am trying to decide whether it makes more sense to write code for the changes into each script which controls the player variable (like put different power up modifiers in the gun script for example) and then have those check a static variable in the global stats to turn them on or off, or whether I should try to track all that in the global stats object and just set the different variables to new values from that object. I guess the heart of the matter is: will I be better off having many scripts checking a static variable or variables as to the players state of progress or should I have my object tracking score linked to all the weapons etc and modifying their variables from logic inside the score tracking script? Hope the question is clear. I know this is more of a design question than a strict scripting question, but I feel like the decision I make here will have wide ranging consequences including how organized my scripts are and for overall performance and wanted to seek some advice. thanks in advance! M.

Viewing all articles
Browse latest Browse all 84

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>