• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to dedicate certain classes to certain frames?

Explorer ,
Mar 26, 2014 Mar 26, 2014

Copy link to clipboard

Copied

I don't go through details at this stage and just explain my issue:

How can I assign different classes to different frames? For example class A to frame 1, classes B & C to frame 2, D to frames 6 and 10...

I'm programming a game by AS3 in Flash CS5  which I want different frames to act as a whole different game level and totally different classes except one, lets say THE HERO:p Which means I don't want to code the frames directly and just want them to read class files and then  they do the job.

You may not need to read the rest but in case you have time:

"The whole game has some pages such as intro, personal profile, options etc and then levels, and all in different frames. Every frame has its own code and the level frames may only share 1 or 2 custom classes. The point is I want to be able to have variables with the same name in different frames but not having the same meaning! var/function "a" is defined in 2 frames but not considered duplicated! And that's the reason i need to read different .as files in different frames and when going to next frame everything from the last one should be vanished, gone (except the user data such score which is saved in a specified class). The main reason I'm currently facing this issue is that I've already coded the whole game in the Main Class and put/removed all the backgrounds, objects, eventListeners as the player goes through levels, dynamically and the variety of values is killing me. So i decided to program every frame as a whole new level and place the visual objects of my scenes by Hand on the screen!"

Please tell me if the path I've taken is totally wrong. This is the first semi-complicated game I'm making and I wish to learn the correct way to program such games having many different levels in the mean of code and visual objects. Any suggestion?

I apologize for my poor grammar and misspellings.

TOPICS
ActionScript

Views

661

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 26, 2014 Mar 26, 2014

you can create members of class A in frame 1 and members of class B in frame 2, but you can't assign more than one document class to a single fla.

you could create a new fla for each game level.  each fla could then have its own document class.

your main fla would load the different levels so you could load level 1 in frame 1, level2 in frame 2 etc.

Votes

Translate

Translate
Community Expert ,
Mar 26, 2014 Mar 26, 2014

Copy link to clipboard

Copied

you can create members of class A in frame 1 and members of class B in frame 2, but you can't assign more than one document class to a single fla.

you could create a new fla for each game level.  each fla could then have its own document class.

your main fla would load the different levels so you could load level 1 in frame 1, level2 in frame 2 etc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2014 Mar 26, 2014

Copy link to clipboard

Copied

whould you explain more about "you could create a new fla for each game level".

So for example when the player finishes level 1 another fla is called for level 2?! How?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2014 Mar 26, 2014

Copy link to clipboard

Copied

use the loader class to load the level swfs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 27, 2014 Mar 27, 2014

Copy link to clipboard

Copied

Kglad,

1. What technic do you suggest if I'm planning to do it for ios devices in future? Does Loader play the same and best role also for them?

2. In general for a game in which game levels have totally different objects and look (something like those 100 games named "Doors" which you need to find a way to open the door and leave the 2D room) what do you thing is the best way to manage the level objects... Placing each level in a different frame or making them in different FLAs and Loading SWFs or whatever u find most efficient?

and thx for your comments

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 27, 2014 Mar 27, 2014

Copy link to clipboard

Copied

LATEST

no, i would not recommend using different frames for different levels.

i like to use a main class that handles the display.  that does not involve micromanaging the display but determining what is seen on-stage and that is done by adding and removing displayobject extending classes. 

eg, there may be an intro class, a help class and game class and a game-over class.

each class may use a number of other classes some of which may be displayobjects and some may not.

the largest class is probably going to be the game class.  the game class may use a number of level classes but would probably use one level class which accepts a parameter that determines the level number.  that level number would be used by the level class to build the display.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines