How to make an imagebutton with focus mask but for transparent buttons?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
searchwindows
Regular
Posts: 68
Joined: Wed Dec 15, 2021 6:17 pm
Contact:

How to make an imagebutton with focus mask but for transparent buttons?

#1 Post by searchwindows » Tue Dec 21, 2021 7:38 pm

I understood that focus_mask =True will allow non-transparent area to be selected.

For example,

Code: Select all

Screen kitchen:
	add "kitchen_bg.jpg"
	imagebutton:
		hover "apple_hover.png" focus_mask = True action Null
		idle  "apple_idle.png" focus_mask = True action Null

This will make the apple function with idle and hover as long as the cursor hovers over the non-transparent part of the apple_idle.png.

But if theres already an apple on kitchen_bg.jpg, and you create ANOTHER apple as apple_idle.png for idle imagebutton, that mean's the apple from kitchen_bg.jpg is overlapped by the apple_idle.png idle image and is no longer shown. How do I make it so that the apple from kitchen_bg stay, and still make apple_idle work if I made it transparent?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to make an imagebutton with focus mask but for transparent buttons?

#2 Post by Remix » Tue Dec 21, 2021 7:52 pm

Your problem is the action Null and the =

Code: Select all


	imagebutton:
                focus_mask True 
                action NullAction()
		hover "apple_hover.png" 
		idle  "apple_idle.png"
Frameworks & Scriptlets:

searchwindows
Regular
Posts: 68
Joined: Wed Dec 15, 2021 6:17 pm
Contact:

Re: How to make an imagebutton with focus mask but for transparent buttons?

#3 Post by searchwindows » Tue Dec 21, 2021 8:32 pm

I found a workaround by using a transparent image for idle.png
and defining a focus_mask image as the apple.png.

If there is a simpler way to do this, I'm all ears!

Post Reply

Who is online

Users browsing this forum: No registered users