diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-12-23 18:37:29 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-12-23 18:37:29 -0300 |
commit | 12f8454a324eb1816bfa19ae8522567239719041 (patch) | |
tree | f3ef2a841ee792c60535ebf38d4827da13d6fbdc /game | |
parent | ca5f5e4953a9b23c9eaf34215380c8e1c3c60c09 (diff) | |
download | client-12f8454a324eb1816bfa19ae8522567239719041.tar.gz client-12f8454a324eb1816bfa19ae8522567239719041.tar.bz2 client-12f8454a324eb1816bfa19ae8522567239719041.tar.xz client-12f8454a324eb1816bfa19ae8522567239719041.zip |
Optimize the code
Diffstat (limited to 'game')
-rw-r--r-- | game/03_init.rpy | 11 | ||||
-rw-r--r-- | game/inventory.rpy | 10 |
2 files changed, 12 insertions, 9 deletions
diff --git a/game/03_init.rpy b/game/03_init.rpy index d659afa..cb6969f 100644 --- a/game/03_init.rpy +++ b/game/03_init.rpy @@ -368,3 +368,14 @@ init python: MUSIC_PROLOGUE02=RetString("sfx/prologue.mp3") MUSIC_PROLOGUE03=RetString("sfx/shining.mp3") +init 1 python: + def unitsquare(uid, atl=czoom_70): + show_img("square_%d" % uid, False) + try: + btn=At("square_%d" % uid, atl) + except: + btn=At("square_0", atl) + traceback.print_exc() + stdout("[ERROR] ATCODE FOR square_%d is INVALID" % uid) + return btn + diff --git a/game/inventory.rpy b/game/inventory.rpy index c67b031..a1c6e7f 100644 --- a/game/inventory.rpy +++ b/game/inventory.rpy @@ -84,15 +84,7 @@ screen inventory(blank=False, filters="True"): #print str(item) #print str(alu) if evl: - python: - show_img("square_%d" % item["unit_id"], False) - try: - btn=At("square_%d" % item["unit_id"], czoom_70) - except: - btn=At("square_0", czoom_70) - traceback.print_exc() - stdout("[ERROR] ATCODE FOR square_%d is INVALID" % item["unit_id"]) - #btn=At("square_10000300", czoom_70) + $ btn = unitsquare(item["unit_id"], czoom_70) imagebutton: idle btn action Return(i) |