"Bothering" a displayed character/Make character graphic a tappable target?

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
User avatar
Kaji
Regular
Posts: 87
Joined: Thu Nov 17, 2022 10:17 pm
Github: Kaji01
Discord: Kaji#7767
Contact:

"Bothering" a displayed character/Make character graphic a tappable target?

#1 Post by Kaji »

I'm looking at adding some branching and secret paths to my game by tapping onscreen objects—not hard to do, it's essentially the same method I used to create my translator's note buttons.

One option I'm looking at for this is tapping on the characters directly at specific points to trigger a 4th-wall break.

Would the appropriate method here be to overlay the character image with a clear image to use as a tap target and have the action be a jump to another label, or is there a better way to achieve this?

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: "Bothering" a displayed character/Make character graphic a tappable target?

#2 Post by _ticlock_ »

Kaji wrote: Mon Dec 05, 2022 9:48 am Would the appropriate method here be to overlay the character image with a clear image to use as a tap target and have the action be a jump to another label, or is there a better way to achieve this?
I guess it depends on your preferences and how you would like to use it.

Why not to use a character image as imagebutton, this way you don't need any transparent overlay. It is also helpful if you have some transforms to apply to the image.
For example:

Code: Select all

screen clickable_image(img, at_list = [default]):
    imagebutton:
        at at_list
        idle img
        focus_mask img                        # if necessary, or add another displayable for focus_mask
        action Call("some_label")             # or Jump("some_label")
        
label start:
    show screen clickable_image("eileen")
    "Don't you dare touch me"

Post Reply

Who is online

Users browsing this forum: Google [Bot]