A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: [F8] [HELP]The dynamic name

  1. #1
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259

    [F8] [HELP]The dynamic name

    My game has finaly came out of the Alpha stage and the beta is running pretty well but I'm having a problem with my bullets and baddies. I know that the problem is that the dynamic names are used over while the name is in use. Is there a way I can use an 'If' statement that I can put in my spawn function that can check if the name of the movie clip.

    use the mouse to shoot at the baddies.
    D-keys to move.
    Press the space bar to charge your super wave.
    you may want to set it to low q.

    enjoy

    My Game
    CEO OF

  2. #2
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    You might not need an if statement. Why don't you post the section of code where they are named or explain to us, and perhaps we can help you further?
    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
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259
    I would put out the code be there are so many lines in the baddy spawn function. I think my problem is easy to understand. You know that movieclips with the same name don't work in flash. I am making these bad guys and bullets dynamicly so I my probram is to name my movie clips differently. The baddies are spawned every 2 secs and i'm only using the names from 1 to 10(like "Ship"+i). I only use 1 to 10 because the while statement to see if the baddies are touching(so they don't over lap ) will run faster. When I shoot a baddy what will happen is the i in "Ship"+i will -- and that will allow more baddies to spwan, but there lies the problem. I'm not going to hit "Ship"+1 I'm going to hit "Ship"+4 or "Ship"+8 which will knock off the counter so I make "Ship"+1 when it is already in action. I want to know if there is a way to tell if there is a movie in action so I don't over write the name spawning new ones.
    Last edited by zervell; 12-02-2006 at 09:57 PM.
    CEO OF

  4. #4
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    you could use 2 arrays to check that,- one array containing all the names that are in use,- and the other one containing the names that are available. Each time you either create or dispose 1 movieClip alter those arrays as well.
    That way you always know wich names are available when creating a new one

  5. #5
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    I would suggest, like I did with my last game, storing the enemies and bullets in seperate arrays, and then pushing the enemies in when they are spawned, and splicing them out when they are killed.
    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

  6. #6
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259
    Thanks ImprisonedPride and renderhjs for the idea. I was hopping you could tell me how to use the array in flash. In C++ I would just make an Array by
    Code:
    int name[#ofelements];
    name[iofelements]=baddy_name_used;
    how could I do the same code above in flash AS? And thanks once more for all the help.
    CEO OF

  7. #7
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    Code:
    var enemies = new Array();
    If you have aim, message me at this alias, and I can help you further/more in person.
    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

  8. #8
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901
    if you remove the enemy mc after it's death you can just check if the mc exists before you reuse it

    Code:
    if (mcContainer[strEnemyName] != null) { // mc is not pressent in container
      // ... add it here
    }
    quick and ... easy ...

    if you don't remove them ... well just give 'em a flag like
    bIsAlive ... set it to true if you start using the mc and set it to false after the mc's death.

    Code:
    if (!mcContainer[strEnemyName].bIsAlive) { // mc is not used anymore
      // ... re-init
    }
    of course you still need to check if the mc is present ...

    nGFX

  9. #9
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259
    Thank you nGFX for the idea. Thats what I wanted to get at the "this["shipx"+i] == null'. Which tells me if i can use the name or not. thank you ImprisonedPride for the 1 on 1 to help me learn about arrays. this the sample code

    Code:
    if (numatplay<numwantplay) {
    	i++;
    	if (this["shipx"+i] == null) {
    		numatplay++;
    		this.attachMovie("baddy", "shipx"+i, getNextHighestDepth());
    	}
    }
    if (i>=numwantplay) {
    	i = 0;
    }
    CEO OF

  10. #10
    Style Through Simplicity alillm's Avatar
    Join Date
    Mar 2004
    Location
    Wales
    Posts
    1,988
    This reminds me of neon. What happened to your other game? By the way, the game ran pretty slow for me when there were lots of particles, you might want to think about reducing them a bit. The super charge almost killed it.

    Ali

  11. #11
    Senior Member zervell's Avatar
    Join Date
    May 2004
    Posts
    259
    the other game 'level black -2' has to be recoded. I was being lazy and that can't work in a platform. I want to build a platform game better than fancy pants(my platform rival). I'm just not ready for a game like that yet. I'm sticking to this game, I feel like i really have a hold on the coding and concepts. I have fix

    lag problem

    speed problem

    name problem

    load bar problem

    space bar problem

    and now I'm getting closer to a full BETA. If you play the latest version update I think you'll see it has a few things neon doesn't.

    D-keys to move
    Left click to shoot
    or hold it down for full charge

    beta 0.9
    CEO OF

  12. #12
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    the shake is a nice effect, i would make it a bit more subtle though, also look into angular blurring, it might be a bit of a fudge but its worth it
    lather yourself up with soap - soap arcade

  13. #13
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    The screen moving in and out constantly; eh it makes me a bit sea sick... I really like the effect, but like malee said, maybe not too much?

    Also, I see you reduced the particle amount like I suggested.
    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

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