I did some googling before attempting and found one game folder on github that was made with the deprecated ui. functions.
Though it does work flawlessly, I don't wish to use the code. Its also not as customisable as I require.
I found another post by PyTom, that doesn't work with the version of Ren'Py I am using (6.99.14.3134)
So I resigned to making my own.
The base "game" was simple to make, only took a few minutes of fiddling around and double-checking in the documentation.
My issue comes in when I try to customise how it looks.
What I am trying to do is have a bar on the left with a number inside it reflecting your total number of wins. I then plan to duplicate the bar for losses and ties.
After a certain number of wins (currently 1 for testing purposes) the bar is supposed to switch out with a flaming bar for visual effect.
My issue though is that the flaming bar is appearing instead of the non-flaming bar, despite me not even "winning" any games and I cannot tell why. I checked and "wins" is definitely registering 0.
Here is the code I've been pulling my hair out over for the last ~4 hours
Code: Select all
define d = Character("Developer")
## 10fps
image bar_animated:
"gui/interface/00_bar_hot.png"
pause 0.1
"gui/interface/01_bar_hot.png"
pause 0.1
"gui/interface/02_bar_hot.png"
pause 0.1
"gui/interface/03_bar_hot.png"
pause 0.1
"gui/interface/04_bar_hot.png"
pause 0.1
"gui/interface/05_bar_hot.png"
pause 0.1
"gui/interface/06_bar_hot.png"
pause 0.1
"gui/interface/07_bar_hot.png"
pause 0.1
"gui/interface/08_bar_hot.png"
pause 0.1
"gui/interface/09_bar_hot.png"
pause 0.1
"gui/interface/10_bar_hot.png"
pause 0.1
"gui/interface/11_bar_hot.png"
repeat
default result = "none"
default rps_opponent = "1"
default selection = "none"
default wins = "0"
label start:
scene rps
show screen stats
label rps:
menu:
"Rock, Paper, Scissors!"
"Rock":
$selection = "rock"
$rps_opponent = renpy.random.randint(1, 3)
"Paper":
$selection = "paper"
$rps_opponent = renpy.random.randint(1, 3)
"Scissors":
$selection = "scissors"
$rps_opponent = renpy.random.randint(1, 3)
"End":
jump fin
label results:
####rock####
if rps_opponent == 1 and selection == "rock":
$ result = "rock"
jump tie
elif rps_opponent == 1 and selection == "paper":
$ result = "rock"
jump win
elif rps_opponent == 1 and selection == "scissors":
$ result = "rock"
jump lose
####paper####
if rps_opponent == 2 and selection == "rock":
$ result = "paper"
jump lose
elif rps_opponent == 2 and selection == "paper":
$ result = "paper"
jump tie
elif rps_opponent == 2 and selection == "scissors":
$ result = "paper"
jump win
####scissors####
if rps_opponent == 3 and selection == "rock":
$ result = "scissors"
jump win
elif rps_opponent == 3 and selection == "paper":
$ result = "scissors"
jump lose
elif rps_opponent == 3 and selection == "scissors":
$ result = "scissors"
jump tie
label tie:
d "We tied with [result]!"
jump rps
label win:
d "[selection] beats [result], you win!"
$ wins += 1
jump rps
label lose:
d "[result] beats [selection], you lost!"
jump rps
label fin:
return
Code: Select all
screen stats():
modal False
zorder 100
if wins >= 1:
vbox:
yalign 0
xalign 0
add "bar_animated"
else:
vbox:
yalign 0
xalign 0
add "gui/interface/bar.png"
I've tried deleting persistent, adding [wins] to the script to check it is indeed "0", recompiling all files, etc.
I cannot work out why the wrong image is showing.
If I reverse the if to if wins <= 1: then I get the opposite effect, the flaming bar never shows, despite winning numerous times. Only the regular bar shows instead.