Solarus-Games English Forum

Solarus => Development => Topic started by: froggy77 on July 26, 2015, 08:20:49 PM

Title: Question: How to attach a pickable heart to a custom entity?
Post by: froggy77 on July 26, 2015, 08:20:49 PM
I see this method  'pickable:get_followed_entity()' exists so I guess it is possible to attach a pickable heart to a custom entity  would return together to the hero.
Perhaps with movements? But how then appoint an unnamed pickable heart created automaticcally by the engine?I can get the sprite with a table, but not the entity.
Title: Re: Question: How to attach a pickable heart to a custom entity?
Post by: Christopho on July 26, 2015, 09:39:49 PM
pickable:get_followed_entity() only works with the hookshot and the boomerang.
You can define the on_position_changed() event on your custom entity, and call set_position on the pickable from there.

The collision callback of your custom entity is the entry point: if the custom entity collides with a pickable, then you know the pickable in your script even if it has no name.
Title: Re: Question: How to attach a pickable heart to a custom entity?
Post by: froggy77 on July 26, 2015, 10:48:00 PM
OK so I fetch in this sense.
Thank you!