How to reference actors from others?
mesaticus
Member Posts: 51
I'm new to GameSalad (only a week or so) and I find myself struggling with the concept of getting actors/objects to communicate with one another after checking their conditions. I used to do a lot of game development in Flash so I may be getting to focused on how I'd do it there...
What I'm trying to accomplish: I have a Hero, multiple Triggers, and an Enemy. I want the Hero to interact with a Trigger to "arm" it. I then want the Enemy to check if the Trigger is armed or not. Based on that, it might have an affect on the Enemy.
What I have so far:
1.) Actions on the Trigger that says if it collides with the Hero, set a boolean attribute I created within that Trigger to "true".
2.) On the Trigger actor itself, I have a rule that states if it collides with the Enemy and its trigger value is true...then I'd like it to do something to the Enemy (by default all the Trigger values are set to false). It's my assumption at this point, I want to put a Change Attribute into the Rule and change an attribute of the Enemy (say it's health or color or position), yet in the drop downs that come with that behavior, the Enemy isn't listed? Only Game, Device, and the Trigger Actor)
The flipside to that would be to put the rule on the Enemy and say "if you collide with a Trigger, and it's attribute is set to "true" then change an attribute within the Enemy. In that scenario I have no idea how to access the attribute of that specific Trigger (I see Game, Device, and the Enemy Actor). So it's kind of the same problem.
Hopefully that makes sense. Again I'm fairly new to GameSalad so any tutorial or "go read this" would be grateful. I've tried searching but not sure what to search for really.
Thanks!
What I'm trying to accomplish: I have a Hero, multiple Triggers, and an Enemy. I want the Hero to interact with a Trigger to "arm" it. I then want the Enemy to check if the Trigger is armed or not. Based on that, it might have an affect on the Enemy.
What I have so far:
1.) Actions on the Trigger that says if it collides with the Hero, set a boolean attribute I created within that Trigger to "true".
2.) On the Trigger actor itself, I have a rule that states if it collides with the Enemy and its trigger value is true...then I'd like it to do something to the Enemy (by default all the Trigger values are set to false). It's my assumption at this point, I want to put a Change Attribute into the Rule and change an attribute of the Enemy (say it's health or color or position), yet in the drop downs that come with that behavior, the Enemy isn't listed? Only Game, Device, and the Trigger Actor)
The flipside to that would be to put the rule on the Enemy and say "if you collide with a Trigger, and it's attribute is set to "true" then change an attribute within the Enemy. In that scenario I have no idea how to access the attribute of that specific Trigger (I see Game, Device, and the Enemy Actor). So it's kind of the same problem.
Hopefully that makes sense. Again I'm fairly new to GameSalad so any tutorial or "go read this" would be grateful. I've tried searching but not sure what to search for really.
Thanks!
Comments
http://forums.gamesalad.com/discussion/24219/can-you-make-an-actor-reference-another-actor-s-attribute
But that seems like a nightmare if I have a lot of triggers. It means I have to edit each instance? Ugh. Also, if there are a lot of these triggers and "Constrain Attributes" rules, how does that effect performance?
If there is a better solution, I'd love suggestions.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I'm still trying to wrap my head around terminology and how this software works and organizes things esp when placed in the game area. Coming from an OOP background I assume my master Trigger Actor has certain properties and each instance of that Trigger that I place in the game can be uniquely tweaked? Aren't Game Level attributes considered more global variables? Would I have to create a unique game level attribute for each trigger?
I know for instance in Flash I could just replicate the main Trigger Actor and name it, say "Trigger1, Trigger2" etc and it was easy to track and change each of those unique instances. I'm not really getting that that is possible in GameSalad unless you break it from the prototype.
Hopefully that wasn't a ramble. Thanks for any help and clarification you can provide.
As to you question of a prototype on the scene being customized without breaking the prototype. Check out this video I have on just that,
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
My example:
Lets say I have 3 boxes in order from left to right and all have a boolean set to false. The player avoids box 1, collides with box 2, and avoids box 3. Because of the players collision, box 2 boolean is now set to true.
An enemy comes along and collides with box 1. It's false so it no effect. The enemy collides with box 2. It's true so it affects the enemy in some way.
Placing the rules on the boxes with the interaction with the player are easy enough. Those booleans work fine.
Placing the rules on the boxes with interactions of the enemy are a different story. It seems like if I want to affect the enemy in some way (say it's position), I have to access scene level attributes to get to the enemies properties, which break my box prototype. (for example get the enemies current position and subtract 100)
My next steps are just having the enemy/box collider change a global attribute value (and maybe have the enemy always look for those changes?). Not sure, still experimenting. But then of course I have to reset that attribute for the next box.
I should say my current protoype works just like I want...just seems like a nightmare if I need to update those boxes as your example video stated.
Thanks again!
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I worry a tad how complex I can get with this drag-n-drop approach thru GameSalad, but so far, I'm able to get way past where I was at with Unity, in just a matter of a few days. I really can't wait to stress test stuff with graphics now to see how things perform. In a few weeks I hope to get the dev license so I can do that
I know this software is still in beta, but I also can't wait for the little things (I'm sure I'm joining the list of others). Stage Zoom, Rulers, Alignment options, snapping, maybe asset libraries you can actually organize with folders, etc...I really miss those in this software.
Thanks again for your help.