summaryrefslogtreecommitdiff
path: root/game/gui/battle.rpy
diff options
context:
space:
mode:
Diffstat (limited to 'game/gui/battle.rpy')
-rw-r--r--game/gui/battle.rpy110
1 files changed, 68 insertions, 42 deletions
diff --git a/game/gui/battle.rpy b/game/gui/battle.rpy
index aa81a1c..c0934a3 100644
--- a/game/gui/battle.rpy
+++ b/game/gui/battle.rpy
@@ -62,7 +62,18 @@ init python:
return
return
-# FIXME: Allow to drag spheres around
+ # FIXME: Allow to drag spheres around
+ def c_swap(idx):
+ global csid
+ if csid is None:
+ csid = copy.copy(idx)
+ return
+ o1 = copy.copy(Battle["spheres"][csid])
+ o2 = copy.copy(Battle["spheres"][idx])
+ Battle["spheres"][csid] = copy.copy(o2)
+ Battle["spheres"][idx] = copy.copy(o1)
+ csid = None
+ return
#############################################################################
screen battle_mobs():
@@ -155,32 +166,24 @@ screen battle_core():
child At("gfx/actionarea.png", party1)
draggable False
yalign 1.0
- # Display the sphere
- ## FIXME
- ## Alternative 1 - Make this a button
- ## Player clicks on the button - some function is called
- ## TODO: What does the function do?
- ## → backup = copy.copy(Battle["spheres"])
- ## → (We actually could just copy the whole `Battle`
- ## and allow players to "revert"/"reset" the screen)
- ## → Probably waits for you to click/tap on another sphere?
- ## Once it finishes, it swaps the elements in Battle["spheres"] array
- ## The blitting is frequent enough
- ## So you don't need to cast a redraw() nor anything
- ## Just swap them and it *should* work right away as far as
- ## visual goes
- ## -----------
- ## Note: You do not need to preserve the original array
- ## However, well, if the array gets corrupted........
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][0])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
+
if (fx1 and Battle["party"][0]["hp"] <= 0):
add At("gfx/off.png", party1)
+ # Display the sphere
+ imagebutton:
+ idle ("gfx/sphere/"+str(Battle["spheres"][0])+".png")
+ selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][0])+".png")
+ hover ("gfx/sphere/"+str(Battle["spheres"][0])+".png")
+ selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][0])+".png")
+ selected csid is 0
+ action Function(c_swap, 0)
+ keysym "alt_1"
+ xpos 0.125
+ xanchor 0.5
+ yanchor 1.0
+ ypos config.screen_height-10
+
# One drag group per party member defined in Battle
draggroup:
xpos 0.50
@@ -213,15 +216,23 @@ screen battle_core():
child At("gfx/actionarea.png", party2)
draggable False
yalign 1.0
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][1])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
if (fx2 and Battle["party"][1]["hp"] <= 0):
add At("gfx/off.png", party2)
+
+ imagebutton:
+ idle ("gfx/sphere/"+str(Battle["spheres"][1])+".png")
+ selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][1])+".png")
+ hover ("gfx/sphere/"+str(Battle["spheres"][1])+".png")
+ selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][1])+".png")
+ selected csid is 1
+ action Function(c_swap, 1)
+ keysym "alt_2"
+ xpos 0.375
+ xanchor 0.5
+ yanchor 1.0
+ ypos config.screen_height-10
+
# One drag group per party member defined in Battle
draggroup:
xpos 0.75
@@ -254,15 +265,23 @@ screen battle_core():
child At("gfx/actionarea.png", party3)
draggable False
yalign 1.0
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][2])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
if (fx3 and Battle["party"][2]["hp"] <= 0):
add At("gfx/off.png", party3)
+
+ imagebutton:
+ idle ("gfx/sphere/"+str(Battle["spheres"][2])+".png")
+ selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][2])+".png")
+ hover ("gfx/sphere/"+str(Battle["spheres"][2])+".png")
+ selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][2])+".png")
+ selected csid is 2
+ action Function(c_swap, 2)
+ keysym "alt_3"
+ xpos 0.625
+ xanchor 0.5
+ yanchor 1.0
+ ypos config.screen_height-10
+
# One drag group per party member defined in Battle
draggroup:
xpos 1.0
@@ -295,16 +314,23 @@ screen battle_core():
child At("gfx/actionarea.png", party4)
draggable False
yalign 1.0
- drag:
- child ("gfx/sphere/"+str(Battle["spheres"][3])+".png")
- draggable False
- droppable False
- yalign 1.0
- xalign 0.5
if (fx4 and Battle["party"][3]["hp"] <= 0):
add At("gfx/off.png", party4)
+ imagebutton:
+ idle ("gfx/sphere/"+str(Battle["spheres"][3])+".png")
+ selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][3])+".png")
+ hover ("gfx/sphere/"+str(Battle["spheres"][3])+".png")
+ selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][3])+".png")
+ selected csid is 3
+ action Function(c_swap, 3)
+ keysym "alt_4"
+ xpos 0.875
+ xanchor 0.5
+ yanchor 1.0
+ ypos config.screen_height-10
+
#############################################################################
screen battle_bars():
####################################################