Can I make one set of rules for various enemies?

Get help using Construct 2

Post » Sat Aug 31, 2013 9:02 pm

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!
B
4
Posts: 7
Reputation: 214

Post » Sat Aug 31, 2013 9:11 pm

Check out Families.
https://www.scirra.com/manual/142/families

It's not part of the free version though. FYIArcadEd2013-08-31 21:13:05
B
100
S
32
G
11
Posts: 1,552
Reputation: 21,612

Post » Sat Aug 31, 2013 9:22 pm

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.
B
4
Posts: 7
Reputation: 214

Post » Sat Aug 31, 2013 9:29 pm

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. ^^
B
4
Posts: 7
Reputation: 214

Post » Sat Aug 31, 2013 9:56 pm

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.
B
20
S
7
G
4
Posts: 322
Reputation: 4,521


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests