TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
Resolved Questions
→
[SOLVED] Communicate between actors
Pages:
1
[SOLVED] Communicate between actors
twinter3
Posts: 98
February 07, 2012, 11:13:27 am
SOLVED
Was not aware of "for each actor type"
I am having a problem determining which code blocks to use to do the following:
Behavior on an actor tells another actor to play a specific animation.
So for example an actors health level dips below 50% tell another actor (the heart) to play Heart Animation 2.
I am having trouble wrapping my head around it.
« Last Edit: February 07, 2012, 11:32:33 pm by twinter3 »
Hectate
Posts: 4643
February 07, 2012, 11:22:09 am
Once you have that "Update Health" you don't need code blocks. Just send a message to the actor to "Update Health".
Are you having trouble figuring out how to refer the the specific actor you want to send the message to?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.
twinter3
Posts: 98
February 07, 2012, 11:26:01 am
Thanks for the quick response. Yes, I am having trouble referring to the specific actor. Switch animation won't allow me to specify an actor, or maybe I am just doing it wrong.
Hectate
Posts: 4643
February 07, 2012, 11:39:55 am
You have a few options.
You can create a new attribute of type "Actor". You would then put that new attribute in the block in place of the "self" to refer to the actor which that attribute represents. When you attach this behavior to a scene you can then select an actor from the scene to be used as that attribute in the behavior.
If your behavior is attached to an actor instead, you would need to double-click on the actor (that has that behavior you're showing us) to customize it and select an actor from the current scene.
Finally, there's a popular way to have the behavior automatically find and use the appropriate actor - it's best for situations where there is only one of the actor in question (such as the player usually). This may be helpful in your case, read the thread below if you'd like to try that.
http://community.stencyl.com/index.php/topic,922.msg7791.html#msg7791
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.
twinter3
Posts: 98
February 07, 2012, 12:52:20 pm
Ok, so using option one (I have the behavior on the scene) how would I target the actors when they are being created through code? What you layed out in option one works great, but when I don't have the actors in the scene to select from, how do I target them?
Hectate
Posts: 4643
February 07, 2012, 06:20:32 pm
So from your OP edit, you've got this now?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.
twinter3
Posts: 98
February 07, 2012, 11:34:02 pm
Correct. Thanks for the help
This was my solution:
Pages:
1