Hi,
First off – thanks for making this – defold is wonderful.
I am making a game with platforms that characters jump on, and after a time, the platforms disappear. When they run out of time the platform broadcasts a “platform_disabled” message to a game logic script letting it know:
if self.time_to_live==0 then
msg.post(".", "disable")
msg.post("/game_logic", "platform_disabled",{platform_id = go.get_id()})
end
The game logic script which responds to a “platform_disabled” message from the platform itself and then sends out another “platform_disabled” message to the characters.
The central game logic script knows which characters are in the world because it dynamically spawns them and retains a reference to them like so:
self.a_character_id = factory.create("#character_factory", etc..)
Then it tries to re-broadcast the message like so:
msg.post(self.a_character_id, "platform_disabled",{platform_id = message.platform_id})
The character script receives the message, but oddly the game logic script also receives the message.
Since the game logic script receives it’s own message, this ends up creating a ton of messages. The game logic script posts the message again, and again, etc, rather than just positing it once.
When I changed the message name to “a_platform_disabled” only the character script got the message, like so
msg.post(self.a_character_id, "a_platform_disabled",{platform_id = message.platform_id})
My question is, am I addressing the instances incorrectly, or is there a better way to do it? Or should I be trying to use unique message names in general just to be safe?
Thanks again for making this wonderful engine!
Alex