Re: Lucia - OpenSource AudioGame engine written in Python
Hello everybody. I originally wrote to you asking for an example of a menu in Lucia. Searching on this topic I found an example already written, which however gave an error. I corrected it, and added a few things to make it more complete. It would be useful to insert these examples in Lucia, so that users are not confused as it still happens to me, not knowing how to use different modules.
import lucia, sys
from lucia.ui import menu2
lucia.initialize(audiobackend=lucia.AudioBackend.BASS)
#Window tytle
test = lucia.show_window("Menu")
#Now we insert the menu elements
MenuItems= [
menu2.MenuItem("start", can_return=True),
menu2.MenuItem("options", can_return=True),
menu2.MenuItem("die", can_return=True),
menu2.MenuItem("exit", can_return=True),
]
#Now let's list the sounds of the menu
menu1=menu2.Menu(items=MenuItems, clicksound="scroll1.wav", entersound="enter1.wav", edgesound="border1.wav", itempos=0, _on_index_change_=None)
#We make the menu come out only when the user presses exit.
while 1:
result = menu1.run()
if result[0]["name"] == "die":
lucia.output.speak("test")
if result[0]["name"] == "options":
lucia.output.speak("There are the options!")
if result[0]["name"] == "exit":
lucia.output.speak("Thanks for playing!")
lucia.quit()
sys.exit()
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector