[SOLVED] Hover to Check Affection Points?

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
Syphe
Newbie
Posts: 6
Joined: Mon Jul 29, 2013 4:51 am
Projects: Medieval Jump, Night Jump
Tumblr: jumpvolumes
Contact:

[SOLVED] Hover to Check Affection Points?

#1 Post by Syphe »

Greetings~ I have a question regarding how to show affection points in another screen that can be accessed from the quick menu.
I am hoping that hovering over a picture of a character would show the dialogues of said character to determine how close they are to you.

So, what I have so far is to use imagemap.

This is an example of the screen background:
Image

And then when you hover over the character, it would show a bubble speech like this:
Image

My question is... Is it possible to use the if statements in screens.rpy considering all the love points are scripted in the script.rpy? As in, is there any way to call it over? I don't quite understand the difference of these things yet and whether or not they're separated.

My second question would be... Can one script several hover pictures? Due to hovering over specific hotspots would show a different image. Or perhaps I shouldn't use hover at all and just let people click on the characters to go to another screen... hmm...

All help is appreciated, thank you in advance!
Last edited by Syphe on Thu Jan 29, 2015 3:14 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Hover to Check Affection Points?

#2 Post by philat »

1. Renpy reads all the files and does not care where you put something -- i.e. you can jump to labels in different files or call functions from different files or whatever. Variables are also not siloed in different files.

2. Conceptually, what you want is the hovered action for hotspots to show another screen with the information you want, and unhovered to hide it. See here for more on how to do that: http://www.renpy.org/doc/html/screens.html#hotspot

The code would end up looking something like this.

Code: Select all

hotspot (223, 202, 92, 22) action [something] hovered [Show("screen_name")] unhovered [Hide("screen_name")]
You just have to add whatever dialogue, etc. you need to the screen you're hiding and showing, and use variables to bring up the right one.

User avatar
Syphe
Newbie
Posts: 6
Joined: Mon Jul 29, 2013 4:51 am
Projects: Medieval Jump, Night Jump
Tumblr: jumpvolumes
Contact:

Re: Hover to Check Affection Points?

#3 Post by Syphe »

Ahhhh, thank you so much!! Much appreciation!

After several tests, I find it preferable to use the mousearea function since all the screen does is hover over things and there's no clicking function.
Now my code looks like:

Code: Select all

screen chibimenus:
    imagemap:
        ground "menu_girls_ground.png"
        
        mousearea:
            area (84, 63, 159, 219)
            hovered Show("chibifel", transition=dissolve)
            unhovered Hide("chibifel", transition=dissolve)
        
screen chibifel:
    if fel_love == 0:
        add "menu_fel_idle.png"
    if fel_love == 1:
        add "menu_fel_1.png"
Once again, thank you!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]