Move an image that is already shown on screen [SOLVED]

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
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Move an image that is already shown on screen [SOLVED]

#1 Post by mugenjohncel »

Move an image that is already shown on screen... as the title says BUT without using show command...

Is it possible to move an already "shown" image to another position?

A bit of context... my screen is 800 by 600 and I "show" an (animated) image at position 400 x-axis and 200 y-axis then a bunch of text dialogue lines later I wanted to move that very image to another position from it's current position of 400 x-axis and 200 y-axis to 200 x-axis and 100 y-axis within 3 seconds "WITHOUT" using show...

The problem with show is that it "resets" the animation once it is declared and shown again so basically, I am looking for the equivalent of "Move this image (animation) that is already shown on the screen from this position to that position within 3 seconds"

If it's possible, please tell me how to do it... I badly needed this for an RSP framework I've been working on and off for quite some time and I am very close to have it work...

Thanks in Advance...
Last edited by mugenjohncel on Sat Jul 15, 2017 4:25 pm, edited 1 time in total.

User avatar
Evildumdum
Regular
Posts: 191
Joined: Sun Jan 18, 2015 8:49 am
Projects: ApoclypseZ
Contact:

Re: Move an image that is already shown on screen...

#2 Post by Evildumdum »

There was a question very similar to this asked not too long back. The example code i use in this uses a screen, but it should translate over to good ol' renpy show commands (you can use variables with the "show command just like you can with the "at" command in screens)

viewtopic.php?f=8&t=44792
"If at first you don't succeed, try hitting it with a shoe."

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Move an image that is already shown on screen...

#3 Post by IrinaLazareva »

Code: Select all

image myimage:
    Text("1", size=100)
    1
    Text("2", size=100)
    1
    Text("3", size=100)
    1
    Text("4", size=100)
    1
    Text("5", size=100)
    1
    Text("6", size=100)
    1
    Text("7", size=100)
    1
    Text("8", size=100)
    1
    Text("9", size=100)
    1
    repeat    
    
transform mypostwo:
    pos(400, 200)
    linear 3.0 pos(200, 100)
    
default goon = False        
screen testin():
    add "myimage":
        if not goon:
            pos(400, 200)
        else:
            at mypostwo

label start:
    "1"
    show screen testin
    "2"
    $ goon = True
    "3"
    "4"
    hide screen testin
    "5"                
    return
            
P.S. This is crazy idea, I know...

User avatar
Evildumdum
Regular
Posts: 191
Joined: Sun Jan 18, 2015 8:49 am
Projects: ApoclypseZ
Contact:

Re: Move an image that is already shown on screen...

#4 Post by Evildumdum »

There's also a slightly simpler method that involves using a while loop.

Code: Select all

init python:
    toggle = True

label start:
    while toggle == True:
        show Example_image at Position1
    else:
        show Example_image at Position2

    $ renpy.pause(20)

    $ toggle = False
"If at first you don't succeed, try hitting it with a shoe."

User avatar
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Re: Move an image that is already shown on screen...

#5 Post by mugenjohncel »

ZOMG!!!

Thanks to both of you... not only I solved my initial problem of optimizing my game, both of your code samples lead me to actually fix another unrelated problem... and the biggest eye opener of all is IrinaLazareva's code using transform... you have no idea how much I've been struggling to comprehend how transform in Ren'py work and I typically animate manually the hard and painful way to circumvent my shortcoming but thanks to you I now fully comprehend how Transform works in general... I now have unlocked an entire galaxy of possibilities to abuse... thank you very much...

"POOF" (Time to re-write A TON of things)

Post Reply

Who is online

Users browsing this forum: Google [Bot]