Hi All!
I am creating a "Build Your Scene" menu for my game (Girl In Charge):
1) When you click the menu, this screen is displayed, where you can select which background you want:
2) When you select the background, this new screen is displayed, where you select which character you want to add to the scene:
3) When you select your desired character, this new screen is displayed, where you can setup the character (flip, select face and clothes):
4) When you are done and click the character image, you have to select which position the character will be placed in the screen:
5) After this selection, you can choose to add more chars or not (up to 5 chars per scene):
6) If you select "Yes", you go back to step 2 (any characters that were already select will be unavailable). If you select "No", the next screen is displayed, where you select who is the speaker on the scene you are creating:
7) You can select one of the characters you've added to the scene or "Someone else" (where you can type the character name). I selected "Vanessa" and this screen is presented, where you can type the text she will speak:
8) After you type your text and hit "Enter", you will see the scene you just built. So far, so good:
9) If you click anywhere, you'll get the option to modify the text or to close the scene. All this is working fine.
PROBLEM: I am not able to reset the characters when I enter the screen again. I use the same character images used in the game itself, but if I try to reset them to the initial state from inside the screens, I'm not able to modify the characters anymore. Does anyone has any idea? I can share pieces of the code if needed.
Sample character images for Victoria:
Person class:
Defining Victoria (vi) as a person:
If I use "$vi.initChar()" from whithin the game, it works fine, the person is reset to its initial state. However, this does not work from whithin the screens... If I do that in the screens, the character does not change its face, clothes or flips, and no errors happen...
Any ideas / suggestions?
Thanks in advance!!!
I am creating a "Build Your Scene" menu for my game (Girl In Charge):
1) When you click the menu, this screen is displayed, where you can select which background you want:
2) When you select the background, this new screen is displayed, where you select which character you want to add to the scene:
3) When you select your desired character, this new screen is displayed, where you can setup the character (flip, select face and clothes):
4) When you are done and click the character image, you have to select which position the character will be placed in the screen:
5) After this selection, you can choose to add more chars or not (up to 5 chars per scene):
6) If you select "Yes", you go back to step 2 (any characters that were already select will be unavailable). If you select "No", the next screen is displayed, where you select who is the speaker on the scene you are creating:
7) You can select one of the characters you've added to the scene or "Someone else" (where you can type the character name). I selected "Vanessa" and this screen is presented, where you can type the text she will speak:
8) After you type your text and hit "Enter", you will see the scene you just built. So far, so good:
9) If you click anywhere, you'll get the option to modify the text or to close the scene. All this is working fine.
PROBLEM: I am not able to reset the characters when I enter the screen again. I use the same character images used in the game itself, but if I try to reset them to the initial state from inside the screens, I'm not able to modify the characters anymore. Does anyone has any idea? I can share pieces of the code if needed.
Sample character images for Victoria:
Python:
# Victoria
image victoria_unflipped = Composite(
(640, 1080),
(0, 0), ConditionSwitch(# Hair / Body
"vi.hair == '01'", "actors/vi/vi_hair_01.webp",
"True", "actors/vi/vi_hair_01.webp" #shows the default naked body
),
(0, 0), ConditionSwitch(# Face
"vi.face == 'happy'", "actors/vi/vi_happy_01.webp",
"vi.face == 'shock'", "actors/vi/vi_shock_01.webp",
"vi.face == 'smirk'", "actors/vi/vi_smirk_01.webp",
"True", Null() #shows default face, from the body image
),
(0, 0), ConditionSwitch(# Clothing
"vi.clothes == 'bar'", "actors/vi/vi_bar_01.webp",
"vi.clothes == 'dress01'", "actors/vi/vi_dress_01.webp",
"True", Null() #no clothes
)
)
image victoria_flipped:
"victoria_unflipped"
xzoom -1.0 # flips sprite
#xpos 0.25 # shifts flipped sprite, if needed
image victoria = ConditionSwitch("vi.flipped == 'N'", "victoria_unflipped", "vi.flipped == 'Y'", "victoria_flipped")
image crop_victoria_unflipped = Crop((120, 30, 400, 320), "victoria_unflipped")
image crop_victoria_flipped:
"crop_victoria_unflipped"
xzoom -1.0 # flips sprite
image side victoria = ConditionSwitch("vi.flipped == 'N'", "crop_victoria_unflipped", "vi.flipped == 'Y'", "crop_victoria_flipped")
Python:
class Person:
def __init__(self, character, name, hair_list, face_list, clothes_list, tool_list):
self.c = character
self.name = name
self.flipped = "N"
self.hair_list = hair_list
self.hair = hair_list[0]
self.face_list = face_list
self.face = face_list[0]
self.clothes_list = clothes_list
if clothes_list <> "":
self.clothes = clothes_list[0]
else:
self.clothes = ""
self.tool_list = tool_list
if tool_list <> "":
self.tool = tool_list[0]
else:
self.tool = ""
def initChar(self):
self.flipped = "N"
self.hair = self.hair_list[0]
self.face = self.face_list[0]
if self.clothes_list <> "":
self.clothes = self.clothes_list[0]
else:
self.clothes = ""
if self.tool_list <> "":
self.tool = self.tool_list[0]
else:
self.tool = ""
return
def flip(self):
if self.flipped == "N":
self.flipped = "Y"
else:
self.flipped = "N"
return
def getLayerNames(self):
layerNames = []
if len(self.hair_list) > 0:
layerNames.append("Hair")
if len(self.face_list) > 0:
layerNames.append("Face")
if self.clothes <> "":
layerNames.append("Clothes")
if self.tool <> "":
layerNames.append("Tool")
return layerNames
Defining Victoria (vi) as a person:
Python:
define vi = Person(Character("Victoria", color="#FF0C20", image="victoria"),
"Victoria",
["01"],
["happy", "shock", "smirk", "none"],
["bar", "dress01", "none"],
""
)
Any ideas / suggestions?
Thanks in advance!!!
Last edited: