Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:19:05+00:00 2026-06-01T09:19:05+00:00

First Question in here :) (AS3) First off, how do I access a variable

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:19:06+00:00Added an answer on June 1, 2026 at 9:19 am

    First off, how do I access a variable from another class?

    -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.

    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.

    -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.

    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.

    -I’ve implemented turn base gameplay before, here is how i did it, keep in mind that it is prolly not the best implementation.

    BattleManager
        Members:
        -BattleScenario (this contains all the meta data for your battle scenario, teams, map location, any modifiers that are related to a battle)
        -Teams (this is a list of Team classes wich have players)
        -TeamSequence(this is a list of team wich will be populated from Teams and will control the flow of the battle)
        Functions:
        -StartBattle
        -EndBattle
        -GiveTeamTurn (this function gets the TeamSequence and calls ActTurn on the Class Team and removes the team from the TeamSequence list)
        -RepopulateTeamSequence(when the TeamSequence is empty this is called to repopulate the TeamSequence)
    
    Team
        Members:
        -Players (this is a list of players)
        Functions:
        -ActTurn (this function calls a player that is still able to act during the turn, and tells him to act, this is where you prompt the user for actions or use your AI)
    

    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 !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My first question here... I want to use an abstract class A from which
this is my first question here. Writing some code, i receive this error from
First question here. I am trying to instantiate a generic class using the type
first question here :) I'm currently experimenting with my first WordPress theme over at
This is my first question here. I have a complicated SQL database and I
First question here: it is a very short yet fundamental thing in Java that
First question here so hello everyone. The requirement I'm working on is a small
this is my first question here :) I know that I should not check
This is my first question here so try to make my best so you
Ok, I need help. This is my first question here. Background: I am working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.