I get the following error:
0] Error: Failed to load script 'scripts/lib/zefk_entity_lib.lua': [string "scripts/lib/zefk_entity_lib.lua"]:2093: '(' expected near '['
when trying this:
function sprites[index]:on_animation_finished()
sprites[index]:set_animation(end_anime)
sol.audio.play_sound(end_sound)
end
The following function will only work if I convert my array to a normal variable.
sprites2 = sprites[2]
function sprites2:on_animation_finished()
sprites[index]:set_animation(end_anime)
sol.audio.play_sound(end_sound)
end
Is there a way around this because I'd like to on_animation_finish() without having a limit set. I do not want to do something like this:
sprites2 = sprites[2]
function sprites2:on_animation_finished()
sprites[index]:set_animation(end_anime)
sol.audio.play_sound(end_sound)
end
sprites1 = sprites[1]
function sprites1:on_animation_finished()
sprites[index]:set_animation(end_anime)
sol.audio.play_sound(end_sound)
end
sprites3 = sprites[3]
function sprites3:on_animation_finished()
sprites[index]:set_animation(end_anime)
sol.audio.play_sound(end_sound)
end
sprites4 = sprites[4]
function sprites4:on_animation_finished()
sprites[index]:set_animation(end_anime)
sol.audio.play_sound(end_sound)
end
sprites5 = sprites[5]
function sprites5:on_animation_finished()
sprites[index]:set_animation(end_anime)
sol.audio.play_sound(end_sound)
end