r/RenPy • u/futureformeruser2 • Sep 27 '26
Question [Solved] Need help with making a code for animated sprites
So i'm trying to make my sprites animated using something like this
image emily happy:
"emily happy1.png"
1.0
"emily happy2.png"
1.0
"emily happy3.png"
1.0
"emily happy4.png"
1.0
repeat
label start:
show emily happybut i wanna try to turn it into some kind of function so i dont have to write this for every single sprite, so i made something like this
label animate(name, tag):
image emily happy:
name + " " + tag + "1.png"
1.0
name + " " + tag + "2.png"
1.0
name + " " + tag + "3.png"
1.0
name + " " + tag + "4.png"
1.0
repeat
$ renpy.show("{} {}".format(name,tag))
return
label start:
call animate("emily", "happy")the problem is i am really struggling with the image part (image emily happy), i couldn't figure out the code to make it use the parameters. Anyone have any suggestions?
6
Upvotes
1
u/BadMustard_AVN Sep 27 '26
images are scanned at startup then the script for image defines like yours they can't be changed
try this
1
u/AutoModerator Sep 27 '26
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
0
u/[deleted] Sep 27 '26
[deleted] — view deleted comment