I am not sure it is a bug in Defold or I do something wrong. Anyway I would like to see detailed message what goes wrong.
To details:
In my asset I have “left_fan” animation group with four images in it. And “right_fan” animation with the same images, but flipped.
One of these images I use in “idle” animation groups, “left_fan_idle” and “right_fan_idle” (also flipped).
I have two game objects “right_fan” and “left_fan” that have only one Sprite component.
In another game object (“block”), I do the following code:
local left_fan_playing_animation = false
local right_fan_playing_animation = false
function final(self)
if right_fan_playing_animation then
msg.post("right_fan#sprite", "play_animation", {id = hash("right_fan_idle")})
end
if left_fan_playing_animation then
msg.post("left_fan#sprite", "play_animation", {id = hash("left_fan_idle")})
end
end
function left_fan(self)
air_force_cur_value = air_force_cur_value - self.air_force_value
if not left_fan_playing_animation then
msg.post("left_fan#sprite", "play_animation", {id = hash("left_fan")})
left_fan_playing_animation = true
end
end
function right_fan(self)
air_force_cur_value = air_force_cur_value + self.air_force_value
if not right_fan_playing_animation then
msg.post("right_fan#sprite", "play_animation", {id = hash("right_fan")})
right_fan_playing_animation = true
end
end
function on_input(self, action_id, action)
if action_id == hash("left_fan") and not action.released then
left_fan(self)
elseif action_id == hash("left_fan") and action.released then
msg.post("left_fan#sprite", "play_animation", {id = hash("left_fan_idle")})
left_fan_playing_animation = false
elseif action_id == hash("right_fan") and not action.released then
right_fan(self)
elseif action_id == hash("right_fan") and action.released then
msg.post("right_fan#sprite", "play_animation", {id = hash("right_fan_idle")})
right_fan_playing_animation = false
...
end
end
Almost in any times, when block is deleted, my game crashes.
I am not sure that the cause of crash is “play_animation”, because, untill block “live”, releasing actions starts idle animations without crashes.
Does anybody have any ideas what is wrong.
UPD:
When I run HTML5 version in Firefox, its console shows the following:
uncaught exception: Assertion failed: version != 0, at: ../src/dlib/message.cpp,250,IsSocketValid at jsStackTrace@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:1:21724
stackTrace@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:1:21907
___assert_fail@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:1:1406372
Uba@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:8:1
js@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:22:1
mj@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:15:1
Ig@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:15:1
Pg@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:15:1
rAa@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:28:1
Runtime.dynCall@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:1:5743
Browser_mainLoop_runner/<@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:1:1411429
Browser.mainLoop.runIter@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:1:1413005
Browser_mainLoop_runner@http://localhost:8080/build/default/__htmlLaunchDir/blowin-in-the-wind/blowin-in-the-wind.js:1:1411363
I hope it’ll help.