custom behaviors

i made a nifty little pop-up animation behavior
trouble is.. when dropping a custom behavior on a new actor, the path "self.size..." retuns an "invalid path" error.
i thought, since it is "SELF." it won't do that.
is there a way around that ?

to be clear, thi si what i do to create a pop up animation:
i attach the self.size to a new attribute i created inside the actor and then i used interpolate to change self.size from small to large with a timer

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited January 2015

    self.original_height and self.original_width are attributes you created within the actor, not one of the pre-existing self.Size attributes. Unfortunately, if you created a custom behavior that utilizes a created self attribute, it will not transfer over to different actors. This makes sense; since you created it in a separate actor, other actors will not contain this attribute. You will need to create the self attribute in all actors and then manually hook up that new attribute in the custom behavior. Simply naming the self attribute the same as the self attribute name in the custom behavior will not work. Sorry.

  • SocksSocks London, UK.Member Posts: 12,822

    Adding to what @Braydon_SFX has already said . . . . (basically self.attributes don't transfer)

    . . . you can use a pre-existing attribute (one that you might have no need for like Angular Drag or Max Speed) to store your values, using these for your values means you can copy code between actors

  • shylevarishylevari Member Posts: 16

    @Socks said:
    Adding to what Braydon_SFX has already said . . . . (basically self.attributes don't transfer)

    . . . you can use a pre-existing attribute (one that you might have no need for like Angular Drag or Max Speed) to store your values, using these for your values means you can copy code between actors

    GENIOUS!!

    i ended up using self.graphics.tile_width/height because it was easier to remember that way which is which

    btw, what r those used for anyways?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Smart idea, @Socks.

    btw, what r those used for anyways?

    Angular Drag is a value that slows down a rotating actor. Drag slows down a moving actor. Max Speed is a value you can set and then enable to be a maximum velocity for an actor.

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

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    Another thing to note, is if you copy a "base actor" and paste it, it will retain those self.attributes and can have rules from other actors based off the same "base actor" with the same self attributes dragged into it without issue.

    Follow us: Twitter - Website

  • shylevarishylevari Member Posts: 16

    @AlchimiaStudios‌ can you give a straight example? do you mean like a master actor that if he rotates, all others will rotate "related" to it?

    @tatiang‌ and what are the tile_width/height are for?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @shylevari said:
    AlchimiaStudios‌ can you give a straight example? do you mean like a master actor that if he rotates, all others will rotate "related" to it?

    No, it means that if you duplicate an actor, you can drag a custom behavior that was made in the original actor and it will work in the duplicate because the self (actor) attributes are already the same.

    tatiang‌ and what are the tile_width/height are for?

    Hmm, I don't use tiling much but I believe those determine the grid size for tiles that are stretched across a scene.

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

Sign In or Register to comment.