A self attribute effecting another actor?

richcoyrichcoy Member Posts: 211
edited April 2012 in Working with GS (Mac)
This sorta relates to a recent question of mine but not directly so I started a new thread.

Lets say you have 10 "baddie" actors on the screen and one "goodie". You only want 3 of the "baddie" actors to have a destroy effect on the "goodie" but they are identical in every other way. I see two ways to handle this:

Option 1: Have two versions of the baddie actors that look identical but have different names and labels. Do an "overlap or collides" on the goodie that only reacts to the kind that can hurt. I'm going to have about 16 different versions of baddies which means 32 different actors to accommodate the kind that can hurt and the kind that can't.

Option 2: Have one version of the baddie but have a self attribute like "canhurt" that you go into on each instance and turn on or off. This sounds more ideal than option one for management of scenes and file size but I'm not sure one actor can see if there is an attribute inside another actor that is turned on or off.

Am I missing an obvious solution?

Thanks.

Rich

Best Answer

  • tatiangtatiang Posts: 11,949
    edited April 2012 Accepted Answer
    You're not missing anything. I'd go with Option 2. Also have a game.IsHurt (boolean) that gets changed to true whenever the "canhurt" baddie collides with the goodie. Then on the goodie, have a rule that says When game.IsHurt is true --> destroy this actor.

    As a side note, it is possible to access actor attributes from another actor by unlocking the actor instance in the scene and then looking in the Scene-->Layers area of the attributes list.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

Sign In or Register to comment.