Multiple enemies

TobyToby Member Posts: 478
edited November -1 in Working with GS (Mac)
Not sure if anyone has covered this already, I want to create multiple enemies spawning from a generator (Gauntlet style for those who know the genera) currently my enemies all have unique game.attributes for different states, die, regenerate, shoot etc

It's getting pretty busy and difficult to maintain. Making new attributes etc for each new enemy is a pain.

I'm sure there is a way to control the number and spawn all these enemies with some simpler code and logic, and one set of game.attributes?

I'm not a programmer obviously, but there has to be a better way.

Any assistance suggestions welcome!

A new wiki entry would be great which demonstrated the logic.

Comments

  • TobyToby Member Posts: 478
    Bueller.....
  • xactoxacto Member Posts: 146
    Toby,
    In my game, all my enemy actors are spawned from a single actor off the screen. Is this what you are trying to do?

    --------------------------------
    StarFire
    http://gamesalad.com/game/play/8901
  • quantumsheepquantumsheep Member Posts: 8,188
    I think Xacto's right.

    If you spawn an enemy, say every 5 seconds, from a single actor, they become instances of the enemy actor.

    So you can spawn multiple enemies and they will all act with the same behaviours you've put in them.

    Talking of which, I'm a bit stuck. In my bugz game I have a new enemy that randomly changes its colour.

    I've tried variables, and can make them change colour fine. It's just that the rule that determines how they're destroyed (based on colour) doesn't seem to work.

    Any tips?

    Cheers,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • xactoxacto Member Posts: 146
    @Quantum,

    I am not sure that you can check a color variable at this time (that would be cool, btw)

    You may need to set up a rule that changes the attribute color (self.color.red) AND a custom variable for each color (self.enemyrRed) so you can FLAG it when it is true or false.

    --------------------------------
    StarFire
    http://gamesalad.com/game/play/8901
  • quantumsheepquantumsheep Member Posts: 8,188
    Yep - I tried that!

    Set up a variable as a randomiser between 1 and 2.

    If 1, change colour to yellow. Change the 'Colour' text Variable to 'Yellow'.

    If 2, change colour to Green. Change the 'Colour' text variable to 'Green'

    Changing the text variable is supposed to flag the enemy as either Green or Yellow. However, as there are two enemies, I'm starting to think that it might need a second text variable.

    Hmmm... I'll try a few things out - thanks though Xacto, made me think!

    Cheers,

    QS

    EDIT:
    AWESOME!!! It now works! Thinking it out loud and taking advice from this board worked wonders!

    My game is now pretty much done :P

    Thanks Xacto, and to everyone else :)

    Cheers,

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.