Same as what i sent before, but each of the imagebuttons now has a fixed: as a wrapper with the xysize set to the full image scale
Viewing post in Need Support? Post here!
default current_chapter = 1
default ch1_selected = False
default ch2_selected = False
default ch3_selected = False
default ch4_selected = False
default ch5_selected = False
default ch6_selected = False
screen chapter_select():
tag menu
on "show":
action [SetVariable("ch1_selected", False),
SetVariable("ch2_selected", False),
SetVariable("ch3_selected", False),
SetVariable("ch4_selected", False),
SetVariable("ch5_selected", False),
SetVariable("ch6_selected", False)]
add "gui/bgs/genericbg.png"
use game_menu(_("CHAPTER SELECT")):
side 'c':
pos (-325, -100) xysize (1920, 1080)
controller_viewport:
mousewheel True draggable renpy.variant("touch")
id "viewport_chapter_select" hscroll_style "center"
scroll_delay (0.5, 0.0)
trap_focus ("up", "down", "left", "right")
scroll_warper "easein"
grid 8 1:
spacing 400
add "gui/chapter_select/card_empty.png" xalign 0.5 yalign 0.45
fixed:
xysize(518, 778)
imagebutton:
xalign 0.5
yalign 0.45
if current_chapter == 1:
default_focus True
auto "gui/chapter_select/card_ch1_%s.png"
action [SetVariable("ch1_selected", True), Show("chapter_confirm")]
at (cardfliphide if ch1_selected else cardflipshow)
hover_sound "sfx/menu_hover.ogg"
activate_sound "sfx/menu_select.ogg"
fixed:
xysize(518, 778)
imagebutton:
xalign 0.5
yalign 0.45
if persistent.ch2_unlocked == True:
if current_chapter == 2:
default_focus True
auto "gui/chapter_select/card_ch2_%s.png"
action [SetVariable("ch2_selected", True), Show("chapter_confirm")]
else:
idle "gui/chapter_select/locked.png"
action NullAction()
at (cardfliphide if ch2_selected else cardflipshow)
hover_sound "sfx/menu_hover.ogg"
activate_sound "sfx/menu_select.ogg"
fixed:
xysize(518, 778)
imagebutton:
xalign 0.5
yalign 0.45
if persistent.ch3_unlocked == True:
if current_chapter == 3:
default_focus True
auto "gui/chapter_select/card_ch3_%s.png"
action [SetVariable("ch3_selected", True), Show("chapter_confirm")]
else:
idle "gui/chapter_select/locked.png"
action NullAction()
at (cardfliphide if ch3_selected else cardflipshow)
hover_sound "sfx/menu_hover.ogg"
activate_sound "sfx/menu_select.ogg"
fixed:
xysize(518, 778)
imagebutton:
xalign 0.5
yalign 0.45
if persistent.ch4_unlocked == True:
if current_chapter == 4:
default_focus True
auto "gui/chapter_select/card_ch4_%s.png"
action [SetVariable("ch4_selected", True), Show("chapter_confirm")]
else:
idle "gui/chapter_select/locked.png"
action NullAction()
at (cardfliphide if ch4_selected else cardflipshow)
hover_sound "sfx/menu_hover.ogg"
activate_sound "sfx/menu_select.ogg"
fixed:
xysize(518, 778)
imagebutton:
xalign 0.5
yalign 0.45
if persistent.ch5_unlocked == True:
if current_chapter == 5:
default_focus True
auto "gui/chapter_select/card_ch5_%s.png"
action [SetVariable("ch5_selected", True), Show("chapter_confirm")]
else:
idle "gui/chapter_select/locked.png"
action NullAction()
at (cardfliphide if ch5_selected else cardflipshow)
hover_sound "sfx/menu_hover.ogg"
activate_sound "sfx/menu_select.ogg"
fixed:
xysize(518, 778)
imagebutton:
xalign 0.5
yalign 0.45
if persistent.ch6_unlocked == True:
if current_chapter == 6:
default_focus True
auto "gui/chapter_select/card_ch6_%s.png"
action [SetVariable("ch6_selected", True), Show("chapter_confirm")]
else:
idle "gui/chapter_select/locked.png"
action NullAction()
at (cardfliphide if ch6_selected else cardflipshow)
hover_sound "sfx/menu_hover.ogg"
activate_sound "sfx/menu_select.ogg"
add "gui/chapter_select/card_empty.png" xalign 0.5 yalign 0.45
screen chapter_confirm():
modal True
frame:
background None
add "gui/chapter_select/card_back.png" xalign 0.501 yalign 0.498
align (0.5, 0.5)
at cardflipcombined
vbox:
xalign 0.5
yalign 0.5
spacing 10
if current_chapter == 1:
text "Would you like to play\nChapter One?" textalign 0.5 style "btn_generic" color "#fff"
if current_chapter == 2:
text "Would you like to play\nChapter Two?" textalign 0.5 style "btn_generic" color "#fff"
if current_chapter == 3:
text "Would you like to play\nChapter Three?" textalign 0.5 style "btn_generic" color "#fff"
if current_chapter == 4:
text "Would you like to play\nChapter Four?" textalign 0.5 style "btn_generic" color "#fff"
if current_chapter == 5:
text "Would you like to play\nChapter Five?" textalign 0.5 style "btn_generic" color "#fff"
if current_chapter == 6:
text "Would you like to play\nChapter Six?" textalign 0.5 style "btn_generic" color "#fff"
textbutton _("Yes"):
at btn_grow
default_focus True
xalign 0.5
text_style "btn_generic"
if current_chapter == 1:
action Start("ch1_start")
if current_chapter == 2:
action Start("ch2_start")
if current_chapter == 3:
action Start("ch3_start")
if current_chapter == 4:
action Start("ch4_start")
if current_chapter == 5:
action Start("ch5_start")
if current_chapter == 6:
action Start("ch6_start")
textbutton _("No"):
at btn_grow
xalign 0.5
text_style "btn_generic"
action [SetVariable("ch1_selected", False), SetVariable("ch2_selected", False), SetVariable("ch3_selected", False), SetVariable("ch4_selected", False), SetVariable("ch5_selected", False), SetVariable("ch6_selected", False), Hide("chapter_confirm")]
key "rollback" action [SetVariable("ch1_selected", False), SetVariable("ch2_selected", False), SetVariable("ch3_selected", False), SetVariable("ch4_selected", False), SetVariable("ch5_selected", False), SetVariable("ch6_selected", False), Hide("chapter_confirm")]
What do your ATL transforms look like?
To be honest, I'm not sure this is a good use case for the controller viewport, or even a viewport at all. Given the animations you want to do, I'd probably just manually assign left/right to swap whatever card is in the center, and use ATL animations to move them to the right location. The cards wouldn't even need to be buttons; you can just have a variable track which one is selected and perform an action accordingly when the button_select action is performed.
transform cardfliphide: xzoom 1.0 ease 0.25 xzoom 0.0 transform cardflipshow: xzoom 0.0 pause 0.4 ease 0.25 xzoom 1.0 transform cardflipcombined: xzoom 0.0 # small start on show: pause 0.4 ease 0.25 xzoom 1.0 # stretch to usual size on hide: ease 0.25 xzoom 0.0 # return to small again
These are my transforms :]
I am not incredibly well-versed in ATL is the thing, so I'm not even sure where I'd begin to do something like that. I thought this was a fine use-case from that perspective. Given they're designed for menus and this is a menu, anyway.