I want to do a simple match3 game and started from the Magic Link Tutorial.
I have a simple 2 frame animation that plays before the tile de-spawns. It works fine when I Build it and Build HTML it, but I tried to bundle it for Android and Windows and the animation does not appear.
My Tilesource is organized like this:
Tile1 - Tile1 Glow - Tile 1 Explosion Frame 1 - Tile 1 Explosion Frame 1
Tile2 - Tile2 Glow - Tile 2 Explosion Frame 1 - Tile 2 Explosion Frame 1
…
Tile6 - Tile6 Glow - Tile 6 Explosion Frame 1 - Tile 6 Explosion Frame 1
Initial animation: Tile X
Animation when tile is selected: Tile X Glow
De-spawn animation: Tile X Explosion Frame 1 + Tile X Explosion Frame 1
The initial animation does appear. The Glow animation does not appear. The Explosion animation does not appear.
The tiles are created with factory.create(tile with Initial animation)
I have set the png to 16bits, still does not work.
Any idea what I might have done wrong or how to fix this?
This will not work in release builds because in release builds it is not possible to get the string representation of a hash.
-- in debug this returns something like hash: [YellowTile]
-- but in a release build you'd get something like hash: [1234567890]
curr_type = tostring(self.type)
You should use have a lookup table where you can go from hash to string:
local YELLOW = hash("YellowTile")
local WHITE = hash("WhiteTile")
local TYPES = {
[YELLOW] = "YellowTile",
[WHITE] = "WhiteTile",
}
function on_message(self, message_id, message, sender)
...
curr_type = TYPES[self.type]
curr_type = curr_type .. "Glow"
PS You should add the local keyword when declaring variables to prevent them from being globally accessible:
local curr_type = TYPES[self.type]
curr_type = curr_type .. "Glow"
I was curious if this is a LUA thing or Defold thing? If it’s Defold, is there documented somewhere things to consider when running debug vs release builds?