Collison_response error

This is where the error happens

function init(self)
	msg.post("camera", "follow", { target = go.get_id(), lerp = 0.1 })
	msg.post(".", "acquire_input_focus")
	msg.post(".", "collision_response")
	msg.post(".", "trigger_response")
	self.on_ground = false
end

and I get this error

iERROR:SCRIPT: /main/player/player.script:9: Field other_id not specified in table
stack traceback:
[C]: in function 'post'
/main/player/player.script:9: in function </main/player/player.script:6>

I would also like to get help with play_animation

this is my code

	msg.post("#sprite", "play_animation", {id = hash("run"))

But all it does is freeze the default animation

The messages trigger_response and collision_response are sent from the engine. The user shouldn’t try to send these. What happens if you remove these?

Ah, thanks. That worked. Any Idea why the animation is not working?

Not sure, don’t you get an error?
The code is malformed, it’s missing an }near the end.It should be:

msg.post("#sprite", "play_animation", {id = hash("run")})

Hi Alvar! What’s the purpose of these two messages? Both are Defold engine generated message. You cannot send these yourself.

The code looks good, but my guess is that your doing this perhaps every frame, which cause the animation to start over on the first frame every frame. You solve this by keeping track of the currently played animation, and if you try to play the same animation again you simply ignore it. Check this example:

Specifically this helper function:

Oh, didn’t see that. You should have an error in the console indicating this.

Thanks for the help. Will try the not setting the animation in update.

But on Linux I cant see the “outline”, so I can’t edit for example a collection. How can I enable it again?

Can you perhaps resize the outline by dragging the resize bar between the outline and the properties?

image

3 Likes