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.
-
GhastlyEster
- Newbie
- Posts: 3
- Joined: Mon Apr 20, 2020 8:56 am
- itch: ester-olsen
-
Contact:
#1
Post
by GhastlyEster » Mon Apr 20, 2020 9:10 am
I've been using animated images to make sprites blink and talk.
Code: Select all
image linnea neutral blinking:
"linnea neutral blinking frame_1"
3.0
"linnea neutral blinking frame_2"
0.016 * 2
"linnea neutral blinking frame_3"
0.016 * 4
"linnea neutral blinking frame_2"
0.016 * 4
repeat
And I would save a lot of time if I could make a function that returns the animation instead of declaring one for each expression.
Code: Select all
show get_blinking_animation("linnea", "neutral")
Tried to write a function like this, but I keep getting syntax errors because I don't know how images work or how the animation language works. Is it possible? How would I do it?
-
rames44
- Veteran
- Posts: 232
- Joined: Sun May 29, 2016 4:38 pm
-
Contact:
#2
Post
by rames44 » Mon Apr 20, 2020 12:29 pm
At present, there isn’t a programmatic interface for ATL. I’ve done something like this in the past using a Creator Defined Displayable, however. The CDD can build the image names dynamically, convert them to Displayable, and then render the correct one at the correct time using the time base passed into the CDD’s render() method.
-
GhastlyEster
- Newbie
- Posts: 3
- Joined: Mon Apr 20, 2020 8:56 am
- itch: ester-olsen
-
Contact:
#3
Post
by GhastlyEster » Tue Apr 21, 2020 9:37 am
Bummer that you can't use ATL like that. Would you share the code for your creator defined displayable? I'll give it a try because I would save so much time.
-
MaydohMaydoh
- Regular
- Posts: 165
- Joined: Mon Jul 09, 2018 5:49 am
- Projects: Fuwa Fuwa Panic
- Tumblr: maydohmaydoh
- Location: The Satellite of Love
-
Contact:
#4
Post
by MaydohMaydoh » Tue Apr 21, 2020 11:00 am
Transforms can take arguments, so you could try using the contains statement in the image and pass a name to the transform.
Code: Select all
transform blinking(name):
"{} blinking frame_1".format(name)
3.0
"{} blinking frame_2".format(name)
0.016 * 2
"{} blinking frame_3".format(name)
0.016 * 4
"{} blinking frame_2".format(name)
0.016 * 4
repeat
image linnea neutral blinking:
contains blinking("linnea neautral")
image linnea happy blinking:
contains blinking("linnea happy")
...etc...
-
GhastlyEster
- Newbie
- Posts: 3
- Joined: Mon Apr 20, 2020 8:56 am
- itch: ester-olsen
-
Contact:
#5
Post
by GhastlyEster » Wed Apr 22, 2020 2:01 am
Thanks! Tried this and it totally works. My game will be done like, SO fast.