Honestly, I would not do anything that you are currently doing at all. Your code is all over the place.
I have created a test project that does/has the following:
A screen on the top with three buttons: "Inventory", "Character", "Spells"
*Inventory and Spells don't do anything, but they are there to make the top screen look nice.
*The Character button pulls up a screen which lists image buttons for all the characters in the list it is passed (in this case the curr_roster of characters).
*Clicking on a character image button opens up another screen with info on the the character that is passed to that screen when you press the button.
This set up requires the Char class to include all of its image paths and info and whatever else is associated with that particular character.
This set up requires a list with all of the current character, which are appended or deleted as needed.
This is tested and works:
Code: Select all
# You can place the script of your game in this file.
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")
init -1 python:
class Char():
def __init__(self, name, but_idle, but_hover, port, info):
self.n = name
self.awpi = but_idle
self.awph = but_hover
self.port = port
self.info = info
screen top_gui():
frame:
hbox:
textbutton "Inventory" action NullAction()
textbutton "Characters" activate_sound 'click.wav' action If(renpy.get_screen("char_roster"), Hide("char_roster"), Show("char_roster", list=curr_roster))
textbutton "Spells" action NullAction()
screen char_roster(list):
frame:
align (0.0, 0.5)
xysize (400, 300)
vbox:
text "Character Roster"
text "-----"
spacing 10
for c in list:
imagebutton:
idle c.awpi
hover c.awph
focus_mask True
activate_sound 'click.wav'
action If(renpy.get_screen("info_screen"), Hide("info_screen"), Show("info_screen", who=c))
screen info_screen(who):
frame align (1.0, 0.5):
vbox:
text "[who.n]"
add who.port
text "-----"
text "[who.info]"
default curr_roster = []
default d = Char("Diana", "dianab_idle", "dianab_hover", "dianaport", "Diana is the science officer.")
default l = Char("Lydia", "lydiab_idle", "lydiab_hover", "lydiaport", "Lydia is the security officer.")
default j = Char("Juliet", "julietb_idle", "julietb_hover", "julietport", "Juliet leada the resistance.")
# The game starts here.
label start:
scene black
show screen top_gui()
"Rignt now, no one should be in the roster."
$curr_roster.append(d)
"Diana should be in the list."
$curr_roster.append(l)
"Diana and Lydia should be in the list."
$curr_roster.append(j)
"Diana, Lydia, and Juliet should be in the list."
I built a distribution of this project in case you want to run it and see what it is like in practice. The placement/style of the screens could, of course, be made nicer...I just put this together quickly.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978