This is a lifebar much like Ace Attorney. It starts full, then when the player get's a wrong answer, it penalizes the player. After 5 strikes, the game is over.
Here's my code.
Code: Select all
default life_current = 5
default life_max = 5
screen life():
vbox xalign 1.0 yalign 0.0:
if life_current = 5:
add "images/UI/life/life_5.png" #I've tried putting "xalign 1.0 yalign 0.0" here instead of at vbox, but it still doesn't work
elif life_current = 4:
add "images/UI/life/life_4.png" #I've tried saying show instead of add.
elif life_current = 3:
add "images/UI/life/life_3.png"
elif life_current = 2:
add "images/UI/life/life_2.png"
elif life_current = 1:
add "images/UI/life/life_1.png"
else:
add "images/UI/life/life_0.png"
Code: Select all
I'm sorry, but an uncaught exception occurred.
After initialization, but before game start.
File "game/truthbullets.rpy", line 4, in analyze_screen
screen life():
File "game/truthbullets.rpy", line 4, in analyze
screen life():
File "game/truthbullets.rpy", line 4, in analyze
screen life():
File "game/truthbullets.rpy", line 5, in analyze
vbox xalign 1.0 yalign 0.0:
File "game/truthbullets.rpy", line 5, in analyze
vbox xalign 1.0 yalign 0.0:
File "game/truthbullets.rpy", line 6, in analyze
if life_current = 5:
SyntaxError: invalid syntax (game/truthbullets.rpy, line 6)
I appreciate any help on this or for helping me understand bars. Thanks.