I don't get why that's happening since I'm not using any persistent data to add money. In case it helps to understand better, the winner is chosen on a screen then the screen jumps to a "x" won blackjack label at which point they get money added to their inventory.
Inventory system:
Code: Select all
init python:
class Items(object):
def __init__(self, name, cost, weight, NoOwned, ID, description):
self.name = name
self.cost = cost
self.weight = weight
self.NoOwned = NoOwned
self.ID = ID
self.description = description
def add_item(self):
self.NoOwned += 1
def remove_item(self):
self.NoOwned -= 1
def add_money_char1(self, currency_char1, amount):
self.amount = amount
currency_char1.NoOwned += amount
def add_item_store_char2(self, currency_char2):
if currency_char2.NoOwned >= self.cost:
currency_char2.NoOwned -= self.cost
self.NoOwned += 1
else:
return
def add_item_store_char1(self, currency_char1):
if currency_char1.NoOwned >= self.cost:
currency_char1.NoOwned -= self.cost
self.NoOwned += 1
else:
return
InventoryChar1 = []
InventoryChar2 = []
p = 0
while p < 50:
InventoryChar1.append(Items("none", 0, 0, 0, p, "none"))
InventoryChar2.append(Items("none", 0, 0, 0, p, "none"))
p += 1
InventoryChar1 = [
Items("Dolars", 1, 1, 0, 0, "Currency"),
]
InventoryChar2 = [
Items("Dollars", 1, 1, 0, 0, "Currency"),
]
Blackjack:
Code: Select all
if char2Points > 21:
play sound BJ_Lose volume .1
show text "{size=+100}{b}BUST" at centerToOverTop(.5, 1.0)
$ char1_blackjack_wins += 1
if char1_blackjack_wins == 5:
jump Char1Win
Code: Select all
label Char1Win:
if char1_blackjack_wins == 5:
$ char1_win_money.add_money_char1(currency_char1, 50)
$ char2_blackjack_wins = 0
$ char1_blackjack_wins = 0
else:
pass