How to implement unlimited gameplay

micksolomicksolo Member Posts: 264
edited November -1 in Working with GS (Mac)
I want to set up a rule like this:

When Level = 1, spawn enemy.actor once
When Level = 2, spawn enemy.actor twice
and so on.

But I want this to happen forever, without having to create a rule that says

When Level = 10

Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor
Spawn enemy.actor

Because its a pain in the butt to have to do it like that. Does anyone know a simpler way to create this kind of situation. I was hoping to use a when game.level = 1
Chg Attribute - Global.Enemy to 10 (and somehow this would spawn the actor 10 times).

Comments

  • RedlerTechRedlerTech Member Posts: 1,583
    Coding is a pain in the but, you have to get used to it. It's not simple.

    Sorry If It Bothers You,
    Matt
  • micksolomicksolo Member Posts: 264
    yes I know what you mean, I thought there might be a simpler solution to this, if not I will code it manually by hand, but I thought someone might have a simpler solution.
  • DrGlickertDrGlickert Member Posts: 1,135
    Copy and paste, man. Copy and paste.

    Also, you could try two timers (one within the other);
    For "game.level" seconds; Every 1 second spawn enemy.actor

    So if you're on level 20 it would read;
    For "20" seconds; every 1 second spawn enemy.actor

    This would spawn 20 actors on level 20. You could use a separate game.attribute for the number of enemies spawned, but I'd stick with whatever level the player is on to do that...

    Good luck!
  • RedlerTechRedlerTech Member Posts: 1,583
    Well I really don't think there is, what you could do is recycle somehow. Have MANY of your actors on the screen and lets say your on level 20, interpolate 20 of them to the screen. It's not like you can in a spawn behavior put a number of how many. That would be nice (possibly an upcoming feature)
    But that takes up RAM.

    EDIT: I got it wait one sec :D
  • RedlerTechRedlerTech Member Posts: 1,583
    WAIT I GOT IT!

    Create an attribute called "level" Every time you beat a level change attribute level to level+1
    Create an attribute called "counter" Everytime your actor is on the scene change counter to counter+1

    Then make a rule
    --When counter DOES NOT equal level--
    *Every 0 Seconds Spawn Your Actor

    Try this, tell me how it goes

    Matt :D
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Your game is going to run very badly when you get to spawning that many actors at once. You need to look at doing things differently. And when you go to gripping about how frustrating it is to have to make a rule for each everything you are wanting to do. Just stop and take a break from GameSalad and do a lesson or tutorial of xCode and all of sudden it wont seem so bad.

    ___________________________________________________________________________________
    TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!

    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • RedlerTechRedlerTech Member Posts: 1,583
    Tenrdrmer, but what about the way I have just mentioned, that way shouldn't be too bad?

    Matt
  • micksolomicksolo Member Posts: 264
    Thanks Matt, I tried your solution but it didn't work. It spawned 1 actor on level 1, but then only one on level 2. was hopeful it would work, thanks for your help!
  • micksolomicksolo Member Posts: 264
    wow, it did work! I just forgot to reset the Actor counter to 0 when it changed levels!!

    Thanks man!
  • RedlerTechRedlerTech Member Posts: 1,583
    Hey Micksolo,
    I am pretty confident that my way should work. If you'd like you can send your project over & I'll mess with it. My email is matthewredler@gmail.com

    Matt

    Full Game Creation Service
    1 On 1 Project Help
  • micksolomicksolo Member Posts: 264
    Hey Matt, yes it worked! Thanks for your help.
  • RedlerTechRedlerTech Member Posts: 1,583
    GREAT :D No problem, what did you do differently now to make it work?

    Matt

    Full Game Creation Service
    1 On 1 Project Help
  • micksolomicksolo Member Posts: 264
    The first time I forgot to reset the Count.Enemy attribute to 0 after completing a level, so actually that attribute was just like it was constrained to the level number, so no new enemy's would spawn. After I reset it to 0, it worked perfectly!!!!

    Thanks so much mate!
  • RedlerTechRedlerTech Member Posts: 1,583
    Not a problem, glad to help!

    Matt :D
  • BrynjeBamsenBrynjeBamsen Member Posts: 188
    Remember to recycle your actors instead spawning new ones... eventually it will kill your performance
Sign In or Register to comment.