Dynamically create ATL
Posted: Thu Aug 18, 2022 5:22 am
I will have quite a bit of simple animations going on in the game. Something I would usually use the ATL blocks for.
Example:
Problem is, there will be A LOT of these. So I want to avoid writing the ATL block for each and every one and would love to define the block but have the image be an argument I pass in. Since this doesn't work with ATL, I though about using a function:
While this works, I am not sure about performance AND it won't work when I need to use several at the same time (presumably because the function is already running).
So calling:
$animationsfunction("image1",50,50)
$animationsfunction("image2",150,150)
will only display image1.
Is there a better way? Either by improving on this function so it can run multiple times, or by using a better renpy alternative?
Example:
Code: Select all
image man1:
"man1_1"
0.2
"man1_2"
0.2
"man1_3"
0.2
repeat
Code: Select all
def animationsfunction(image,x,y):
while True:
renpy.show (image + '_1',at_list=[Position(xanchor = 1, yanchor = 1,xpos=x,ypos=y)])
renpy.pause(0.2)
renpy.hide(image + "_1")
renpy.show (image + "_2",at_list=[Position(xanchor = 1, yanchor = 1,xpos=x,ypos=y)])
renpy.pause(0.2)
renpy.hide(image + "_2")
renpy.show (image + "_3",at_list=[Position(xanchor = 1, yanchor = 1,xpos=x,ypos=y)])
renpy.pause(0.2)
renpy.hide(image + "_3")
So calling:
$animationsfunction("image1",50,50)
$animationsfunction("image2",150,150)
will only display image1.
Is there a better way? Either by improving on this function so it can run multiple times, or by using a better renpy alternative?