I've been trying to get a UI screen for a music player going and I've encountered a few problems I can't figure out with it.
1. How can I get it to show the track number or name in the hbox text (doesn't have to be a hbox either)
2. What am I getting wrong with the Next function? (For next track/bgm)
I have attached the project folder as well
code:
Code: Select all
# Music player script
# defined bgm/tracks
define audio.bgm1 = "/audio/bgm_1.mp3"
define audio.bgm2 = "/audio/bgm_2.mp3"
define audio.bgm3 = "/audio/bgm_3.mp3"
define audio.bgm4 = "/audio/bgm_4.mp3"
define audio.bgm5 = "/audio/bgm_5.mp3"
define audio.bgm6 = "/audio/bgm_6.mp3"
define audio.bgm7 = "/audio/bgm_7.mp3"
# playlists
define playlist0 = [audio.bgm1, audio.bgm2, audio.bgm3, audio.bgm4, audio.bgm5, audio.bgm6, audio.bgm7]
define playlist1 = [audio.bgm1, audio.bgm2, audio.bgm3, audio.bgm4]
define playlist2 = [audio.bgm5, audio.bgm6, audio.bgm7]
# images defined for imagemap
image imagemap_hover_img = "/images/ui_icons/Image_map_icon_music_1_hover.png"
image imagemap_idle_img = "/images/ui_icons/Image_map_icon_music_1_idle.png"
init python:
def start_music_shuffle(playlist ):
renpy.random.shuffle(playlist)
renpy.music.play(playlist, loop=True)
def start_music_play(playlist ):
renpy.music.play(playlist, loop=True)
screen UI_Icon_MusicPlayer():
imagemap:
xpos 0.005
ypos 0.005
ground "/images/ui_icons/Image_map_icon_music_1_idle.png"
idle "imagemap_idle_img"
hover "imagemap_hover_img"
hotspot (297, 322, 91, 102) action Function(start_music_play, playlist0)
hotspot (183, 324, 102, 99) action Function(start_music_shuffle, playlist0) #shuffle
hotspot (405, 328, 89, 97) action Stop(channel='music')
#hotspot (528, 322, 131, 106) action Next() ## What am I doing wrong with this?
#hotspot (38, 320, 135, 110) action Previous() ## What am I doing wrong with this?
hbox:
xpos 0.02
ypos 0.08
text "[playlist0]" ## currently shows list instead of just the currently playing track