function works twice
Posted: Wed Feb 19, 2020 7:34 pm
Hello everyone, I had one unforeseen problem
In my opinion, in the window I need, when the value of a variable of a certain value, an audio signal should be played
I decided that it would be best if the sound I call the function and it will work if the desired value of the variable
But the whole problem is that for some reason the function works twice
variable test introduced to verify this fact
If it’s not difficult, tell me what my error is and why the function works twice
In my opinion, in the window I need, when the value of a variable of a certain value, an audio signal should be played
I decided that it would be best if the sound I call the function and it will work if the desired value of the variable
But the whole problem is that for some reason the function works twice
Code: Select all
init python:
def play_1():
global udar_1
global test_1
if udar_1==True:
renpy.sound.play( "music/wave/udar_lico.mp3")
test_1+=1
if udar_1==False:
renpy.sound.stop()
test_1-=1
return()Code: Select all
screen fight_2():
if udar_1==True:
add "images/fight/bez_or/L_udarv_gol_1.png"xpos 500 ypos 200
add Animation ("images/fight/bez_or/r_poz_baze_1.png",1.0,"images/fight/bez_or/r_poz_baze_2.png",1.0)xpos 700 ypos 200
$play_1()
timer fast repeat True action SetVariable("udar_1",False),SetVariable("xz",True)Code: Select all
default udar_1=False
default test_1=5