Question: How to attach a pickable heart to a custom entity?

Started by froggy77, July 26, 2015, 08:20:49 PM

Previous topic - Next topic
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.

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.