Transform an image as an action?

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
tim640
Regular
Posts: 49
Joined: Wed May 23, 2018 4:47 pm
Contact:

Transform an image as an action?

#1 Post by tim640 »

Good day!
It's a part of one of my previous questions, but i figured it might be a topic on it's own, hope that's alright.
So as the title of the thread says, is it possible to implement Transform() as an action when clicked of hovered over a button? To transform an image.
Something simple like this seems to be impossible:

Code: Select all

hovered Transform("pointchoice2", xzoom=3.788)
Maybe as a Function, like "hovered Function(showstretch)", the function being something like

Code: Select all

init python:
    def showstretch():
        Transform("pointchoice2", xzoom=3.788)
But that doesn't transform the picture when i hover over a button, obviously, although it doesn't give an error either. Is there a proper way of doing that? Maybe there is something like "renpy.transform" existing that works?

Thank you all for your help again!!

UPD: i feel like that might be confusing why don't i just put transformation under "pointchoice2" image code, but there's a reason for that, i need the transformation to be applied externally trough a code like above somehow, if that's even possible...

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Transform an image as an action?

#2 Post by hell_oh_world »

on a screen, you can just setup some variables to trigger the transform:

Code: Select all

screen something():
  default clicked = False
  textbutton "Zoom":
    hovered SetScreenVariable("clicked", True)
  
  add "pointchoice2":
    zoom (3.788 if clicked else 1.0)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], JHeun