Same Movement on Different Entities? (and 'on_obstacle_reached()' question)

Started by The Pink Bunny, June 23, 2016, 03:51:15 PM

Previous topic - Next topic
Can movements only be applied to one entity at a time? I'm trying to have two entities make the same movement a bit delayed from each other, but when the second movement starts, the first just stops. I know I can fix that by just making another movement, but that seems like strange behavior to me. Is that intentional?

edit: Since this question is more trivial than practical (and I don't want to start two threads in a row), I'll also ask this here: Is there a difference between 'entity:on_obstacle_reached(movement)' and 'movement:on_obstacle_reached()' ?

I guess this is intentional since otherwise some functions and events, like get/set_xy and on_obstacle_reached, would have no sense for several entities at the same time. If you still need help to do something with movements, then just explain a bit what you are trying to do :).

For the last question: yes and no. Both functions are called when an obstacle is reached, but as you know they are defined on different entities. So, depending on if you need the event to be called always or only for the current movement (when an obstacle is reached), you should use the corresponding one. The event defined on the movement will be destroyed when the movement does, obviously. Do not worry to ask, even if it seems something silly, because it is not.

In this case, I think it should be said explicitly in the API that a movement can be attached, at most, to only one entity.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."