I’m very new to defold and coding in general as im only in college but i have been struggling over the past few days to respawn my player in the game that I am making.
I am trying to pass a message with this piece of code to the “playerScript” from “playerMovement”, so that when the message is sent, my player will be respawned. I’m sure this is a simple fix or theres a better way to go about it but does anyone have any idea what i should do?
Message system has nothing to do with the file system.
The simplest ways to check what is the address of the script you send message to is to add the following line in init() function in the script:
print(msg.url())
It will be really hard for you to understand how things work if you will not spend some time for manuals reading which covers all the game engine systems.
You are doing the right thing by adding print statements. Reading the manual is good to do; it is a reference not a tutorial so it will not help on it’s own. Add more print statements. For example if you put one on each side of an if statement it might help you spot why it does not get triggered. msg.post() can be a bit tricky at first. Things to look for are, is the receiver (script) getting the message, how to refer to the message id and the message sent. Print stuff out to double check your assumptions. Find an example game that does what you want. It can be annoying that the smallest omission can stop everything working and seem impossible to find; a puzzle solving thing.