First Question in here 🙂 (“AS3”)
First off, how do I access a variable from another class?
You see, my “database” is currently inside a single class, and I need to access it when say, I call “scene_battle”. What is the best way to code this? I would want to get the variable of the class right, and not the instance variable, since I don’t even need an instance of this class, since its just a database.
Secondly, a bit of a more general question about the OOP structure of my game. Currently, it’s like this:
scene_battle calls player and enemy. Player and enemy get data from my database. Basically, I just repeat an instance of my player class, and it will have an ID based on the game party.
If you can give me some general or helpful tips on the code, such as encapsulating something I will be very thankful. Thank you in advance.
-If you want to have a general class who serves as a referencer for values you can use either an instance of a class or a static class, both are equally good.
-If your making reference to getting a pointer like you do in C++, no need to worry about that, all objects that are equalized to another object will be a pointer unless you use the new keyword.
-I’ve implemented turn base gameplay before, here is how i did it, keep in mind that it is prolly not the best implementation.
This is only the big lines, theirs ALOT of stuff that isnt showed here that you must implement. Also be wary that alot of callbacks will be trigged, and exemple would be when the player finishes acting and will call back to its team saying that its done for this turn and that team should call ActTurn for another member of the team until its done, same goes for team that will trigger a callback to battlemanager once every players of the team are done for this turn.
Hope this helps, GL !