interactive images

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
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

interactive images

#1 Post by Izzayuh »

I am currently making an interactive music album using Ren'Py for my current University project.
What I want to do is design a series of panels which will be shown on the screen at the same time, and when one is clicked it will change with another image, while the unclicked images are left unchanged
(I used this video as concept research as this is the type of thing I want, but no transition of sweeping across the page, they will all be in the same position on screen http://jeffbuckley.com/interactive/)
Is there any code I could use which does this, or will I have to turn to other software?
And will I also be able to use simple animations on the clickable images, such as the bobbing of a figure, or would the images have to be still PNGs?
I thought I could have a series of images showing the different parts of each songs story, and when clicked they would show another perspective of the same story, and then once one song is finished, the game would jump to the next scene which would be when the next song on the album would play

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: interactive images

#2 Post by Ocelot »

Nothing really hard about that. A bunch of buttons which will call a python function which will assign next displayable in list to currently displayed one. And a simple timer to change scenes/songs (and if there is a callback when track finishes playin, it is even easier)

As for animations, you can either use movie sprites, meaning that you will have to turn your gif into videofile or disassemble it to several frames and build animation inside RenPy using ATL.
< < insert Rick Cook quote here > >

User avatar
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

Re: interactive images

#3 Post by Izzayuh »

Ocelot wrote:Nothing really hard about that. A bunch of buttons which will call a python function which will assign next displayable in list to currently displayed one. And a simple timer to change scenes/songs (and if there is a callback when track finishes playin, it is even easier)

As for animations, you can either use movie sprites, meaning that you will have to turn your gif into videofile or disassemble it to several frames and build animation inside RenPy using ATL.

okay, so would I set a single image as a button, and then when it was clicked it would change or would the button be above the image as a seperate thing?
I'm pretty new to this software so sorry about that, I'm just still confused as to how to code this

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: interactive images

#4 Post by Ocelot »

A quick example:

Code: Select all

init python:
    buttons = ["images/red.png", "images/green.png", "images/blue.png"]
    button = buttons[0]
    def change_button():
        global button
        global buttons
        buttons = buttons[1:] + buttons[:1]
        button = buttons[0]
        
screen bb:
    imagebutton idle "[button]" action Function(change_button) xalign 0.5 yalign 0.5
Make sure that there are images called "red", "green" and "blue" in "images" folder and later in your code you can do

Code: Select all

show screen bb
and you will see button you can click to change color of the button.
< < insert Rick Cook quote here > >

User avatar
Izzayuh
Newbie
Posts: 15
Joined: Sat Mar 19, 2016 12:06 am
Projects: Masked, Lovetale
Tumblr: izzycle
Deviantart: izzysdoodles
Contact:

Re: interactive images

#5 Post by Izzayuh »

Ocelot wrote:A quick example:

Code: Select all

init python:
    buttons = ["images/red.png", "images/green.png", "images/blue.png"]
    button = buttons[0]
    def change_button():
        global button
        global buttons
        buttons = buttons[1:] + buttons[:1]
        button = buttons[0]
        
screen bb:
    imagebutton idle "[button]" action Function(change_button) xalign 0.5 yalign 0.5
Make sure that there are images called "red", "green" and "blue" in "images" folder and later in your code you can do

Code: Select all

show screen bb
and you will see button you can click to change color of the button.

thank you so so much for the help, this has cleared things up a lot for me. for
"screen bb:
imagebutton idle "[button]" action Function(change_button) xalign 0.5 yalign 0.5[/code]"
the xalign and yalign are what decides the position of the images in this code, correct?

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: interactive images

#6 Post by Ocelot »

Yes it does set position of image. You really want to read documentation: https://www.renpy.org/doc/html/
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: No registered users