Can I make one set of rules for various enemies?

0 favourites
  • 5 posts
From the Asset Store
Human/Character Base Pixel Art Sprites in various poses (nearly 100 files)
  • <font color=teal>I have few different kinds of monsters with different behaviors and all, but most rules applying to the interactions with the player are identical for each one of them. Like if the player collides with the opponent, he loses a certain amount of hp (depending on monster's and player's instance variables; the instance variables are unique for each monster and they can change), same happens to the monster if it gets hit by a bullet or the player jumps on it, etc.

    I was wondering if there's any way to, perhaps, flag every unique monster as an enemy, so instead of copying the rules for each one of them I could simply make a set of rules applying to everything that's flagged as "enemy".

    So instead of:

    "Bullet on collision with monster1 -> substract playerlevel from hp"

    it would be:

    "Bullet on collision with thing flagged as enemy -> substract playerlevel from this certain thing's hp"

    And if not that, any way to make it simpler would be great. Thank you in advance!</font>

  • Check out Families.

    https://www.scirra.com/manual/142/families

    It's not part of the free version though. FYI

  • <font color=teal>Ooh, didn't know about that option, thank you!

    But will this still work with each enemy having individual hp? Each one of them has an instance variable named hp, but it doesn't seem to be working like that.</font>

  • <font color=teal>Ah, never mind, I think I figured it out, just need to set the value for the family and change it for each enemy on the start of layout.

    Thank you so much for your help. ^^</font>

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I know what you're saying and I use it too,

    Family variable> Hp 0

    Start of layout set>

    1's hp 50

    2's hp 26

    etc-- just in case you were using some weird unorthodox method.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)