Page 1 of 1

Renpy

Posted: Wed Nov 17, 2021 3:23 pm
by vicirl
Hi, I'm so sorry if this is the wrong forum, its about renpy. I'm new to this website and still confused on how to work it.
I'm making a game about reincarnation and I have a few coding questions.

Is there a way to change the characters sprite while hovering over an item? not clicking, hovering. /genq
For example, you hover over an item and the character changes his sprite from happy to upset and says "Please don't touch my things."
If that isn't possible I'll just make it so when you actually click on the item it says that.

Thank you! -vicirl :D

Re: Renpy

Posted: Sat Jan 08, 2022 1:44 pm
by jeffster
Hi vicirl,
use forum "Ren'Py Questions and Announcements":
viewforum.php?f=8

Yes, you can. See an example here:
https://patreon.renpy.org/python-tricks-2.html#bgqueue

Basically you put a button or imagebutton on the screen and set its hover action:

Code: Select all

    button:
        hovered bgq.Enqueue("host angry")
        unhovered bgq.Enqueue("host happy")
For a text message that appears on hover, you can set it as a tooltip:
https://www.renpy.org/doc/html/screen_a ... l#tooltips

Or you can use a list of actions on hover (for example, showing some popover screen):

Code: Select all

    button:
        hovered [
                bgq.Enqueue("host angry"),
                ShowTransient(overlay_message, some_text="Don't touch it!")
            ]

screen overlay_message(some_text="Hi!"):
    label some_text