Page 1 of 1

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

Posted: Mon Dec 05, 2022 9:48 am
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?

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

Posted: Mon Dec 05, 2022 1:17 pm
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"