WTS/game/scripts/interface/currency.rpy

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")