[SOLVED] Animated image possible with renpy-python?

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
Ryue
Miko-Class Veteran
Posts: 733
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

[SOLVED] Animated image possible with renpy-python?

#1 Post by Ryue » Wed Aug 07, 2013 4:59 am

Hi
I've got the following image:

Code: Select all

image testimage:
    "pic/water1.png"
    pause 0.5
    "pic/water2.png"
    pause 0.5
    "pic/water3.png"
    pause 0.5
    repeat
I'm normally using renpy.image as I'm dynamically reading the image directory for what images are stored there and prescale them as needed.
So my question here is...is there any way to do the above with renpy.image or something similar?
Last edited by Ryue on Thu Aug 08, 2013 1:12 am, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1336
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Animated image possible with renpy-python?

#2 Post by xavimat » Wed Aug 07, 2013 6:59 am

Hi, Wolf.
Your code is equivalent, acording to: http://www.renpy.org/doc/html/statement ... enpy.image
renpy.image(name, d)
Defines an image. This function is the python equivalent of the image statement.

name
The name of the image to display, a string.
d
The displayable to associate with that image name.
This function may only be run from inside an init block. It is an error to run this function once the game has started.
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
unknown [Sci-Fi - mystery - computer]
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Ryue
Miko-Class Veteran
Posts: 733
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animated image possible with renpy-python?

#3 Post by Ryue » Wed Aug 07, 2013 7:37 am

Exactly renpy.image I'm using to create single images. But the problem in this case is I want to create this "animated" image, and there I'm not sure what commands to use
(a single image is easy: renpy.image("mypic1","pic/water1.png").
For a few I'm also making scales there (example): renpy.image("mypic2",im.Scale(ImageReference("mypic1"),162,877))

but an animation with water 1 0.5 secs pause, water 2, 0.5 secs pause water 3, 0.5 secs pause and repeat from the beginning is where I don't know how to do that with renpy.image (or something similar).

User avatar
xavimat
Eileen-Class Veteran
Posts: 1336
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Animated image possible with renpy-python?

#4 Post by xavimat » Wed Aug 07, 2013 6:02 pm

Sorry to bother you, but, why do you need renpy.image()? Can't do the same with the "image" statement?
(I know I'm not answering but asking...)
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
unknown [Sci-Fi - mystery - computer]
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
nyaatrap
Crawling Chaos
Posts: 1823
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Animated image possible with renpy-python?

#5 Post by nyaatrap » Wed Aug 07, 2013 9:08 pm

Afaik, transform is a displayable which takes other displayables as its arguments then return a new displayable.
So I think you can use renpy.image(name, transform("file.png")), etc
BTW, I'm just using anim.Filmstrip()

Ryue
Miko-Class Veteran
Posts: 733
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animated image possible with renpy-python?

#6 Post by Ryue » Thu Aug 08, 2013 1:03 am

xavimat wrote:Sorry to bother you, but, why do you need renpy.image()? Can't do the same with the "image" statement?
(I know I'm not answering but asking...)
It's no problem.

I'm using renpy.image as I'm doing the whole image declaration automatically.
Thus I'm:
1.) Reading all files in the image directory
2.) I create 1 image per file therein (and 5 create more specifically scaled images for each file)

I found no good way to do that with the image statment thats why I'm using renpy.image for almost all things

Ryue
Miko-Class Veteran
Posts: 733
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: Animated image possible with renpy-python?

#7 Post by Ryue » Thu Aug 08, 2013 1:11 am

nyaatrap wrote:Afaik, transform is a displayable which takes other displayables as its arguments then return a new displayable.
So I think you can use renpy.image(name, transform("file.png")), etc
BTW, I'm just using anim.Filmstrip()
Tnx.

Transform I looked up but didn't see how I could use multiple images there to create an animation.

anim.Filmstrip() looks just like what I was searching for (surprised though that it uses 1 image with multiple frames in it, but still quite useable that way).

Tnx again

User avatar
xavimat
Eileen-Class Veteran
Posts: 1336
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: [SOLVED] Animated image possible with renpy-python?

#8 Post by xavimat » Thu Aug 08, 2013 6:23 am

I've done something similar with DynamicDisplayable (http://www.renpy.org/doc/html/displayab ... isplayable) and the wonderful and barely known config.automatic_images (http://www.renpy.org/doc/html/config.ht ... tic_images).
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
unknown [Sci-Fi - mystery - computer]
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
BluesBoy
Newbie
Posts: 3
Joined: Tue Apr 17, 2018 4:16 pm
Contact:

Re: [SOLVED] Animated image possible with renpy-python?

#9 Post by BluesBoy » Mon Jun 18, 2018 9:37 am

Ryue, hi, have you found a solution?
I tackled the same issue as implementing a code on Python, similar to the one you wrote.
So far I had to write everything myself. Apparently, I duplicate existing functions, but so far I have not found the necessary documentation.

Post Reply

Who is online

Users browsing this forum: No registered users