How to make one actor react when another is touched?

brettw777brettw777 Member Posts: 24
I am asking this to the good people of the forum because I am afraid Tatian is gonna get tired of me soon!

I thought this was going to be quite easy when I thought it up but being new to Gamesalad...I guess not. I have a spotlight and its beam as two separate actors. I want the beam to appear as soon as the spotlight is touched. Here is what I did so maybe someone can tell me where I went wrong. Also, I want the beam to be at .4 alpha.

Beam actor's alpha is at 0 to start. Not sure about that either.

2. created boolean game attribute called beamOn
3. For the beam actor, I have attribute -game.beamOn is true, change attribute self.color.alpha to .4

For spotlight actor that is to be touched to launch the beam:

1When touch is pressed
2. Attribute game.beamOn is false
3. Change attribute game.beamOn to true

I have tested it several (okay many) different ways and sometimes the beam is already on the minute I start the scene. Anyone...please? Thanks!

Comments

  • zweg25zweg25 Member Posts: 738
    edited December 2013
  • Gordio283Gordio283 Member, PRO Posts: 31
    edited December 2013
    U know what I'd suggest, b/c your code is simple. If it isn't working, it must be a simple mistake. Create a new attribute game.Diagnostic1

    Create an object. Have it display and constrain to a variable game.Diagnostic1.

    The object repsonsible for changing game.beamOn, have it also "constrain game.Diagnostic1 to game.beamOn"

    This will show you if beamOn is working. If it is, try "logging" another variable, such as self.color.alpha. (Just remember to turn off the original code that constrains beamOn to diagnostic1) Perhaps self.color.alpha is working fine, but for some reason, it isn't being displayed correctly. "Log" all variables involved to see where the code may have went wrong.
  • brettw777brettw777 Member Posts: 24
    @zweg25, hey thanks a lot for that file! That was really nice of you to make that for someone you don't even know. I am really liking this GS family atmosphere except you all give more than my real family! @Gordio283, thanks for your contribution also.

    Here is the update. Zweg, I followed your behavior guidelines. I did not change the behaviors of the beam that was already in the scene but did change the prototype. That did not work. I then added those same behaviors to the actor beam in the scene and it worked perfectly. I cannot figure out why my prototype beam actor does not change the behaviors of the actor already set in the scene. I don't know if there is a glitch in my GS program or if I am misunderstanding how this is supposed to work. I have just begun making my game and I was under the impression that when the prototype actor's behavior is changed, all of the actors of that prototype change too. Either way, I figured it out and got it working. Thanks again!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @brettw777 I appreciate you not wanting to bother me, but since I saw this... :)

    Make sure the actor on the scene hasn't been unlocked. That's really the only reason that an actor wouldn't behave according to its prototype rules. That or if it depends on the value of a self attribute and that attribute's value has been changed manually on the actor on the scene but not on the prototype actor (essentially giving it an "instance value").

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

  • brettw777brettw777 Member Posts: 24
    Ah, you found this anyway, Tatian! You may have told me before but it does not sound familiar as for the unlocking info. I definitely did have it unlocked at one point but deleted all the (mis)behaviors. I think I also might have had a few attributes in there to that actor that did not belong. Thanks!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    A quick fix/test is to delete the actor from the scene and drag in another (prototype) one from the actor's pane.

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

  • zweg25zweg25 Member Posts: 738
    glad we could help!
Sign In or Register to comment.