Last thing I need help with, is there a way to make a screen action that runs a function? I'll attach screenshots along with code that I've got to give you guys a more detailed view of how the entire thing looks!
Going into the game menu has an option called "Chrystel" that is unclickable until you've reached a certain point in the game. Once you've gained access to the Chrystel Menu, clicking the button will lead you to this screen:
^The "Warrior Lv.1" text signifies the role you've chosen (You get to choose a role in my game, kinda like WoW-classes), "Algan Chrystel: 400" speaks for itself. Algan is the name of the main character and he has 400 chrystel that he can pay with. This screen is made up an imagemap where clicking an orb will take you to another screen. Currently, the only one clickable is the red one in the bottom. Once you've successfully spent the necessary chrystel to get that upgrade, the two orbs above it will become available and you kinda choose a path. I think it's cool, okay?
Now, if you click the red orb, you'll be brought to this screen:
^Here, you will confirm purchasing the upgrade. The "Purchase" button is unclickable if you don't have enough chrystel to buy the upgrade, but for testing reasons I've currently set it so that it can be bought already. So here comes the tricky part, if I click that button, how do I make it run a function? I'll show involved code below, it's very possible that my coding is off, I'd appreciate if you give me tips on how to improve it.
Code: Select all
label start:
#Create perks (name, description, effect, cp_cost=0)
$Atk1 = Perk("Attack +20", "Increases attack by 20. \n\nCosts 500 Chrystel Points.", "Atk20", 500)
Code: Select all
class Perk():
def __init__(self, name, description, effect, cp_cost=0):
self.name = name
self.description = description
self.effect = effect
self.cp_cost = cp_cost
def upgrade(self, cp_cost, effect):
if perk.effect == Atk20:
player.power += 20
player.chrystel -= perk.cp_cost
Code: Select all
vbox align (.2, .47):
textbutton "Purchase":
action [Return (value=Atk1), SensitiveIf(player.chrystel>=400)]
That was a lot of text. So any ideas on how to do it? The reason as to why this doesn't work at the moment is because calling the Return in a menu screen simply takes you back to the game, regardless of what value I attach to it. Any help is appreciated!