Here's the class (condensed for ease) and some example variables:
Code: Select all
init python:
class Card:
def __init__(self, cardnr, cname, card_bg, location):
self.cardnr = cardnr
self.power = cname
self.card_bg = card_bg
self.location = location
init:
$ card1 = Card(1,"fireball","fire.png",1)
$ card2 = Card(2,"ice spike","ice.png",1)
$ p1 = "none"
$ p6 = "none"
$ pcard1_xpos = 100
$ pcard1_ypos = 200
$ pcard6_xpos = 400
$ pcard6_ypos = 500
Code: Select all
screen hand:
imagemap:
ground "trans_ground.png" #transparent
hover "blue_hover.png"
if p1 != "none": ### First slot in hand
hotspot (pcard1_xpos, pcard1_ypos, 93, 133) action [SetVariable(hand_select,1), Return()]
screen field:
imagemap:
ground "trans_ground.png" #transparent
hover "blue_hover.png"
if p6 == "none": ### First slot on field
hotspot (pcard6_xpos, pcard6_ypos, 93, 133) action [SetVariable(field_select,6), Return()]
label play_cards:
$ cardlist = [card1,card2]
$ renpy.random.shuffle(cardlist)
$ p1 = cardlist.pop() ### first card drawn, randomized
jump card_background
label card_background:
if p1 != "none:
show image p1.card_bg:
xpos pcard1_xpos ypos pcard1_ypos
call screen hand
call screen field
jump card_equalize
Code: Select all
label card_equalize:
$ p6 = p1
$ p1 = "none"
$ p6.location = 2
Code: Select all
$ (eval("p"+str(field_select))) = (eval("p"+str(hand_select))) ### $p6 = p1
$ (eval("p"+str(hand_select))) = "none" ### $p1 = "none"
$ (eval("p"+str(field_select))).location = 2 ### $p6.location = 2
Code: Select all
$ temp_var = (eval("p"+str(hand_select)))
$ (eval("p"+str(field_select))) = temp_var