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.
image guyheadbob:
"characters/guyheadup.png"
pause 0.45
"characters/guyheaddown.png"
pause 0.45
if renpy.music.is_playing(channel='music') == True:
repeat
$ renpy.play("song.mp3", channel="music")
guy "Whoa! I love this tune!"
show guyheadbob at place
I've done a fair amount of perusing and experimenting since but haven't figured it out yet. I'm hoping maybe someone can give me some pointers.
Thanks!
Last edited by Panzer Poodle on Fri Aug 18, 2017 6:01 pm, edited 1 time in total.
I realize that I can't put an 'if' condition in an ATL block so I've been looking for ways around that. DynamicDisplayables are cool except they don't seem to work for animations. I also came across Creator-Defined Displayables but that feels just way too complex for what I want.
I guess I'm just wondering if it would be possible to call a function in the ATL block to magically stop the animation if: renpy.music.is_playing(channel='music') == False.
... Or to write a function with the animation in it but I don't know how to do that yet.
If anyone has any tips for me, I would very much appreciate the help.
image bob guyhead:
"characters/guyheadup.png"
.45
"characters/guyheaddown.png"
.45
repeat
image bob stopanima = "characters/guyheaddown.png"
label start:
"...."
play music "song.mp3" noloop
guy "Whoa! I love this tune!"
show bob guyhead at place
while renpy.music.is_playing(channel='music'):
"{nw}"
show bob stopanima at place
guy "Ok. Let's go...."
image bob guyhead:
"characters/guyheadup.png"
.45
"characters/guyheaddown.png"
.45
repeat
image bob stopanima = "characters/guyheaddown.png"
label start:
"...."
play music "song.mp3" noloop
guy "Whoa! I love this tune!"
show bob guyhead at place
while renpy.music.is_playing(channel='music'):
"{nw}"
show bob stopanima at place
guy "Ok. Let's go...."
Hm, for some reason the 'no wait' tag doesn't work... Either way, I'm not sure this is a viable solution to my problem given that he stops bobbing his head as soon as you move the game forward. What I'm trying to accomplish is to have him keep bobbing his head as you're playing the game and just stop of his own 'accord' the minute the music ends... If that makes sense.
Anyways, thanks for the effort. I'll keep cracking at it.
Remix wrote: ↑Thu Aug 17, 2017 7:04 pm
DynamicDisplayables are fine for animations using a function as the first parameter...
While running game code:
File "game/script.rpy", line 246, in script
m "..." with quickdissolve
File "game/script.rpy", line 44, in animate_image
return kwargs['images'][ index ], kwargs['repeat']
TypeError: list indices must be integers, not float
Holy s***!!! It works! :O
I'd been banging my head for days.
Looking at your code, it would have taken me forever to figure it out...
Nothing more to say about it really. Just works perfectly.
Thank you so much for the help Remix!
I will feature you in the credits and the millions (more like 5-6) of people who play my game will know your name.