WTS/game/scripts/interface/currency.rpy
LoafyLemon c7f7f6c8a0 Refactored currencies
* Removed game class (superseded)
* Refactored currencies
* Bug fixes
2024-04-25 20:39:50 +01:00

29 lines
869 B
Plaintext

init python:
def animate_int_value(st, at, old, new, prefix="G"):
if st > 1.0:
return Text(f"{prefix} {new}"), None
else:
if new > old:
value = int((new-old)*(1.0-st)) + 1
d = Text("{} {}\n+{}".format(prefix, old + int((new-old)*st), value))
else:
value = int((old-new)*(1.0-st)) + 1
d = Text("{} {}\n-{}".format(prefix, old - int((old-new)*st), value))
return d, 0.01
screen currency(old, new, prefix):
tag gold
zorder 50
default d = DynamicDisplayable(animate_int_value, old, new, prefix)
frame:
xpadding 10
ysize 44
xminimum 80
background Frame(gui.format("interface/frames/{}/iconmed.webp"), 6, 6)
pos (50, 50)
add d yoffset 3
timer 3.0 action Hide("currency")