A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [CS3] Newbie code structure

  1. #1
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693

    [CS3] Newbie code structure

    Hi, I'm currently working on a game that basically goes from like moving around on a tile based map to then walking into a building then a separate menu comes up and the map disappears. A good example of something similar to what I'm doing is an old game bard's tale for NES. You can see in the pictures below:



    and then on the tile map they run into fight, the map goes away and a battle starts:



    basically this project I'm working on is larger than my skill base which I know immediately gets a bad reaction around here but anyways this is how I like to learn. I'm just curious how to go about structuring code to fit this type of model. I've been working hard on making a tile-based world that fits my needs, I've created a simple editor as well and now I'm curious how when say they enter a door or come to a random fight, whats the best way of temporarily pausing the map and hiding it and calling the fight part of the game, which I haven't started yet.

    I guess a second question is with a game that requires an section for fights and an section for walking around the main map, do you think its better to write each separately then code them to work with each other, or do you think its best to just work with all the code at once?

    Thanks in advance for any insight/help you can give,

    ChaseNYC
    mmm signature

  2. #2
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    I'm doing something similar and I've found it to save me a tremendous amount of work to use OOB with inheritance classes... With it you can easily add transitions and functions to "disable" the main movie while something else is going on... like a fight.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  3. #3
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    PHP Code:
    whats the best way of temporarily pausing the map and hiding it and calling the fight part of the gamewhich I haven't started yet. 
    put the tiles in a movieCLip container wich is on the main stage,- as well as another movieClip holding the figt screen graphics.
    Then you can do whatever neat swapping transition you want, the simplest would be setting one of those 2 movieClips _visible to true and the other one to false.

    PHP Code:
    I guess a second question is with a game that requires an section for fights and an section for walking around the main map, do you think its better to write each separately then code them to work with each other, or do you think its best to just work with all the code at once
    try getting used to OOP like classes, objects ect.,
    Create just 1 flash movie but different Objects or Classes that hold functions for either part. That way you dont get mixed up with similar variable names ect.

  4. #4
    talk to the hand! Never_land:('s Avatar
    Join Date
    Nov 2007
    Location
    your mother's bedroom
    Posts
    490
    "the simplest would be setting one of those 2 movieClips _visible to true and the other one to false."
    That's a bit slow for the flashplayer, I'd say you store the position of all objects and vars, then jump to the fight scene.

  5. #5
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    So I thought I could figure this out on my own by reading up on OOP Inheritance stuff but it seems a little bit more confusing than I expected. I was wondering if someone has a good example of how I would do what IP was talking about via some dummy code or something? Or would it be best for me to post a abridged version of the current structure of my code?
    mmm signature

  6. #6
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    you wrote CS3 does that automaticly mean you code in AS3,- or is it still AS1/2?

  7. #7
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    uhmmm yeah I think I was already using OOP and just didn't know that's what it was called. The only thing I had to change about my code was instead of using addChild to root I'm addChild'ing to empty movieClips on the the stage. I guess this is resolved... sorry and thanks. But yes just to answer your question I am coding in AS3.
    mmm signature

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center