Coordinate in behavior

VeGaS

  • Posts: 14
How do I transfer coordinate X from one object to behavior of another object?

Miasmos Games

  • Posts: 878
Basically you can use one of the blocks under Messaging>For Actor>Attributes. Set up an attribute in the other behaviour and then tell that behaviour the co-ordinate :)

Cupcake Bounce

VeGaS

  • Posts: 14
Can a screenshot for example? :)

Rob

  • *
  • Posts: 1268
I did not code this one but I have a behavior called Aim at Actor on forge (look for Rob) which you can attach to one of the two objects. Once you attach to actor, set player type to the second actor, set range and make sure you also set debug at the bottom.

However, this behavior is actor type based and not actor instance based. Also, it's only distance between 2 objects and not exactly the coordinates. You can use it as reference.

« Last Edit: September 24, 2011, 12:08:52 am by Rob »
GOLDEN RULE #1 : SAVE YOUR GAMES FREQUENTLY
IOS/XCODE DEBUGGING
http://www.stencyl.com/help/view/xcode-ios-troubleshoot/
WATCH STENCYLWORKS VIDEO TUTORIAL BY SUNRISEKINGDOM
http://www.youtube.com/watch?v=KDfRfjzr9j4&feature=channel_video_title

gigaclon

  • Posts: 163
or you can create a custom block that returns whatever number you need and then you can use that block in the behavior that you want to have access to the number. The Messaging block that Miasmos was talking about is get value from behavior, you can use the search bar in the palette. You should play around with it and then come back with questions.

Miasmos Games

  • Posts: 878
Well I've been beaten to it, but here's a screenshot anyway :) Basically, choose an actor, this will set the value for all the actors of that type, (alternately you could have an actor attribute that you get some other way). Then you set the name of the variable, although it must be exactly as you created it, including capitalisation, and have an underscore at the beginning and no spaces, such as can be found as the attribute's real name. Then you set the value of this attributevand for what behaviour it applies.

Cupcake Bounce