I have made a "Button" that starts an Action and also change the Mousecursor on hovering.
This could be nice for a Magnifier,Arrow or so.
It works (the grey image should be much bigger).
Problem:
Hovering the white Button the first time result in ugly delay.
Could i fix that? Image Cache is empty. Sorry i'm non programmer and need to change cursor on hovering.
(The attachment shows a white imagebutton over a black one. White change the cursor to "arrow" and black button back to "default".)
Code: Select all
init:
$ mouse_is =0
image bg Home_R1 = "images/Home_R1/Room_R1_0.png"
image xtop = "images/items/top.png"
image xbottom = "images/items/bottom.png"
image DESK = "images/Home_R1/Dummy_PC.png"
# The game starts here.
label start:
label begin:
scene bg Home_R1 at truecenter
show xtop at top
show xbottom at center
# Image ready for ATL Action as long as white Button is hovered.
if mouse_is ==1:
show DESK behind character_main_anim_PC:
xalign 1.0 yalign 0.607
elif mouse_is ==0:
hide DESK
python:
# ICON
if mouse_is == 1:
ui.vbox(xalign=1.0, yalign=0.55) # Only show if the White Button is hoverd (should be transparent PNG in Game)
ui.imagebutton("images/Home_R1/Dummy_PC_R.png", "images/Home_R1/Dummy_PC_R.png", clicked=ui.returns(None), hovered=ui.returns(32))
ui.close()
ui.vbox(xalign=1.0, yalign=0.55) # (should be transparent PNG in Game)
ui.imagebutton("images/Home_R1/Dummy_PC.png", "images/Home_R1/Dummy_PC.png", clicked=ui.returns(3), hovered=ui.returns(31))
ui.close()
$ result = ui.interact()
#
if result == 3:
jump Desk
elif result == 31:
$ config.mouse = { 'default' : [ ('images/arrow.png', 0, 0)] }
$ mouse_is =1
jump begin
elif result == 32:
$ config.mouse = { 'default' : [ ('mouse.png', 0, 0)] }
$ mouse_is =0
jump begin