[Solved] How to animate items being appended to a list?

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
Deimos96
Regular
Posts: 26
Joined: Tue Nov 15, 2022 5:34 am
Contact:

[Solved] How to animate items being appended to a list?

#1 Post by Deimos96 »

Hi I'm trying to figure out how to show objects being appended one by one to a list. Is there a simple way to do this?

For e.g I have five apples which is being appended one by one to some list. But instead of showing a screen of five apples immediately, I want one apple at a time to pop up on the screen as it is being appended. Maybe this very simple below will help visualize what I'm trying to achieve.

(some screen) #X is apple
X
(..0.5 seconds)
XX
(..0.5 seconds)
XXX
(..0.5 seconds)
XXXX
(..0.5 seconds)
XXXXX
(stop)

Thanks beforehand.
Last edited by Deimos96 on Thu Feb 09, 2023 9:58 am, edited 2 times in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: How to animate items being appended to a list?

#2 Post by _ticlock_ »

Deimos96 wrote: Fri Feb 03, 2023 6:16 pm Hi I'm trying to figure out how to show objects being appended one by one to a list. Is there a simple way to do this?
Do you mean to show images one by one with some delay based on the content of a list? You can do something like this:

Code: Select all

screen show_images_by_one(image_list):
    default total = 1
    hbox:
        for i in range(0,total):
            add image_list[i]
        timer 0.5 repeat True action If(total < len(image_list), SetScreenVariable('total', total + 1))

Code: Select all

label start:
    show screen show_images_by_one(['apple.png', 'apple.png', 'apple.png', 'apple.png', 'apple.png'])

Deimos96
Regular
Posts: 26
Joined: Tue Nov 15, 2022 5:34 am
Contact:

Re: How to animate items being appended to a list?

#3 Post by Deimos96 »

_ticlock_ wrote: Fri Feb 03, 2023 7:00 pm
Deimos96 wrote: Fri Feb 03, 2023 6:16 pm Hi I'm trying to figure out how to show objects being appended one by one to a list. Is there a simple way to do this?
Do you mean to show images one by one with some delay based on the content of a list? You can do something like this:

Code: Select all

screen show_images_by_one(image_list):
    default total = 1
    hbox:
        for i in range(0,total):
            add image_list[i]
        timer 0.5 repeat True action If(total < len(image_list), SetScreenVariable('total', total + 1))

Code: Select all

label start:
    show screen show_images_by_one(['apple.png', 'apple.png', 'apple.png', 'apple.png', 'apple.png'])
Sorry for the late reply. But this works so far. Thank you.

Post Reply

Who is online

Users browsing this forum: No registered users