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 8836065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:24:21+00:00 2026-06-14T09:24:21+00:00

my question is in relation to the decoupling of classes when handling array of

  • 0

my question is in relation to the decoupling of classes when handling array of display objects.

lets assume were making a PacMan game, in my main.as file I would call constructLevel.as to build the different portions(graphics) of the level.

Now lets say the “food” that pacman eats is in an array, foodArray, now would it be better to keep foodArray inside main.as so main can easily access it, or would it be better to have foodArray in constructLevel.

in the first scenerio, constructLevel requires the appropriate variables to exist in main.as, in this case foodArray. In the other case however, main would always need to reference constructLevel.foodArray to grab data, still the same coupling as before but the data has shifted from main to contructLevel

the third solution would be to create a blackBoard which encapsulates all the data.

I’m not sure what the best practice in this case is.

  • 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-14T09:24:22+00:00Added an answer on June 14, 2026 at 9:24 am

    I would go this way… Create the classes: Level, LevelConstructor. So that the LevelConstructor would build the Level objects and return them.
    So, from the main class, we create a new level like this:

    var newLevel: Level = levelConstructor.build(..);
    

    In this case, we have foodArray and all other details of the level in a newLevel object.
    By doing this, we separate the level data and the level building algorithms. The levelConstructor object may have any number of properties and methods for building the levels, anything that your game requires.

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

Sidebar

Related Questions

In relation to this previous question I am trying to create a batch file
In relation to this question i asked earlier: Searching multi-dimensional array's keys using a
My question is in relation this this answer. https://stackoverflow.com/a/8773953/1297775 I have read at many
In relation to my question here , I have a plot for which the
In relation to this question ( Efficient hashCode() implementation ) I have one more
In relation to this stackoverflow question , how would I go about creating my
In relation to my last question ( Is there an easier way of passing
This is in relation to this question . The proposed answers involve adding a
I have a question about Criteria method, one-to-many relation to the database, 'one' is
After my 1st question with relation to CSS3 gradients in which I was recreating

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.