I’m trying to use the Gooey extension to add nicer button and lists.
But I get this error:
views/title/title.gui_script:15: Animation 'button_normal' invalid for node 'play_button' (no animation set)
stack traceback:
[C]: in function 'play_flipbook'
/views/title/title.gui_script:15: in function 'refresh_fn'
gooey.internal.button:9: in function 'fn'
gooey.internal.core:110: in function 'refresh'
gooey.internal.button:31: in function <gooey.internal.button:16>
(tail call): ?
gooey.gooey:80: in function 'button'
/views/title/title.gui_script:41: in function </views/title/title.gui_script:40>
This is my code
local monarch = require "monarch.monarch"
local transitions = require "monarch.transitions.gui"
local gooey = require "gooey.gooey"
local rpg = require "gooey.themes.rpg.rpg"
local function update_button(button)
if button.pressed_now then
gui.play_flipbook(button.node, hash("button_pressed"))
elseif button.released_now then
gui.play_flipbook(button.node, hash("button_normal"))
elseif not button.pressed and button.over_now then
gui.play_flipbook(button.node, hash("button_over"))
elseif not button.pressed and button.out_now then
gui.play_flipbook(button.node, hash("button_normal"))
end
end
local function on_pressed(button)
print("pressed")
end
function init(self)
msg.post(".", "acquire_input_focus")
gooey.acquire_input()
self.transition = transitions.create(gui.get_node("root"))
.show_in(transitions.slide_in_right, gui.EASING_OUTQUAD, 0.6, 0)
.show_out(transitions.slide_out_left, gui.EASING_INQUAD, 0.6, 0)
.back_in(transitions.slide_in_left, gui.EASING_OUTQUAD, 0.6, 0)
.back_out(transitions.slide_out_right, gui.EASING_INQUAD, 0.6, 0)
--update_button(gooey.button("menu_button").set_visible(false))
end
function on_input(self, action_id, action)
rpg.button("play_button", action_id, action, on_pressed, update_button)
if action_id == hash("click") and action.released then
if gui.pick_node(gui.get_node("play_button"), action.x, action.y) then
monarch.show(hash("menu"))
elseif gui.pick_node(gui.get_node("settings_button"), action.x, action.y) then
monarch.show(hash("settings_dialog"))
end
end
end
function on_message(self, message_id, message, sender)
self.transition.handle(message_id, message, sender)
end
“play_button” in the .gui file is just a box with a text inside it
Thanks!