I am working on a game right now in which players are run through a series of choices. They will have to play through each choice on the menu example below, but they get to pick which order they play through them in.
However, I've run into this weird thing where, once all of the choices have been chosen, it keeps looping over and over again, specifically on the 'home' option, and never ends. Can someone help me figure out why? Here is the code I'm using:
Code: Select all
# Declare characters used by this game.
define laika = Character('', color="#c8ffc8", image="laika")
image laika = "images/gui/none.png"
image side laika = "images/characters/laikaneutral.png"
define laikas = Character('', color="#c8ffc8", image="laikas")
image laikas = "images/gui/none.png"
image side laikas = "images/characters/laikasniff.png"
define laikasc = Character('', color="#c8ffc8", image="laikasc")
image laikasc = "images/gui/none.png"
image side laikasc = "images/characters/laikascared.png"
define laikad = Character('', color="#c8ffc8", image="laikad")
image laikad = "images/gui/none.png"
image side laikad = "images/characters/laikadizzy.png"
label splashscreen:
scene black
with Pause(1)
show splash with dissolve
with Pause (2.3)
scene bg darkpurple with dissolve
with Pause (.5)
return
# 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"
image splash = "images/backgrounds/laika-splash-screen.png"
image bg darkpurple = "images/backgrounds/dark-purple-bg.png"
#choices defaults
default choices_text = "I'm in a small place. No way to get out."
default thinking_text = "I should think about something else right now."
default smell_action_done = False
default look_action_done = False
default feel_action_done = False
default move_action_done = False
default home_action_done = False
default trip_action_done = False
default noise_action_done = False
default _game_menu_screen = 'pause_menu'
# The game starts here.
label start:
stop music fadeout 1.1
scene bg darkpurple with dissolve
label choices:
# this checks to see if *all* actions are done. If they are, jump to the think menu instead
if smell_action_done and look_action_done and feel_action_done and move_action_done:
jump think
menu:
laika "[choices_text]"
"Smell" if smell_action_done == False:
$ smell_action_done = True
$ choices_text = "What should I do now?"
jump smell_action
"Look" if look_action_done == False:
$ look_action_done = True
$ choices_text = "What should I do now?"
jump look_action
"Feel" if feel_action_done == False:
$ feel_action_done = True
$ choices_text = "What should I do now?"
jump feel_action
"Move" if move_action_done == False:
$ move_action_done = True
$ choices_text = "What should I do now?"
jump move_action
label smell_action:
laikas "This place smells mostly like me."
laika "I smell urine too. It's mine."
laikad "It's hot in here and I don't feel good. {p}I have been panting ever since the big noise."
jump choices
label look_action:
laika "It's dark. I can't see much. I think it's night time."
laika "There's no one else here."
laika "All I can see is the small window in front of me."
laika "Outside the window is a big blue ball."
laika "It's bright, the only bright thing I've seen today."
jump choices
label feel_action:
laika "The bed I'm in is hard and small."
laika "I think there is something behind me, my tail has touched it."
laika "But I can't turn around to check."
laika "When I lie down, I notice two strange things next to my head. They are cold and metallic."
laika "When I lick the strange thing a tiny piece of food comes out."
laika "Water comes out of the other thing. It's not a lot, but I feel better."
laika "When I turn my head, it feels like something is stuck to me."
laika "I really want to scratch at it so it goes away, but my leg won't reach it."
laika "I hope it goes away soon. INSERT SAD PUPPY WHINE SOUND CLIP HERE"
jump choices
label move_action:
laika "I can't move."
laika "I can sit and stand... {p}but I can't turn around to circle the bed or lie down."
jump choices
if home_action_done and trip_action_done and noise_action_done and move_action_done:
jump credits
menu think:
laikasc "[thinking_text]"
"Home" if home_action_done == False:
$ home_action_done = True
$ thinking_text = "I should think about something else right now."
jump home
"The trip out" if trip_action_done == False:
$ trip_action_done = True
$ thinking_text = "I should think about something else right now."
jump trip
"The Big Noise" if noise_action_done == False:
$ noise_action_done = True
$ thinking_text = "I should think about something else right now."
jump noise
label home:
laikasc "I remember my old home."
laikasc "A long time ago, I lived in another place."
laikasc "The place I lived was far away from humans, I almost never saw them."
laikasc "My old home was surrounded by trees, water, fields, and lots of other animals."
laikasc "It was safe there."
laikasc "The humans that I sometimes saw would come through during the day. Most of the time they were alone, or in small packs."
laikasc "But they never came in crowds, which was good. Crowds are dangerous."
laikasc "Thats why I stayed away from the places with so many humans."
laikasc "Some dogs I know went to the city because there was more food, and that life was easier there."
laikasc "That may or may not be true."
laikasc "But the dogs that I knew that went to the city never came back."
laikasc "When I was a pup, I lived in my old home with my mother, brothers, and sisters. There were many in our pack."
laikasc "We'd run together, hunting for food, finding fun and exciting things."
laikasc "There were bad times, sometimes, but also good times."
laikasc "I loved living at my old home."
jump think
label trip:
laikasc "I remember my old home."
laikasc "I should think about something else..."
jump think
label noise:
laikasc "I remember my old home."
laikasc "I should think about something else..."
jump think
call credits from _call_credits
return
label credits:
image splash2 = Text("{size=90}Company Name", text_align=0.5, ypos=0.5) #Placeholder code if you don't have anything to use as a splash image or are just pure lazy.
# image splash2 = "images/Company-Logo.png" #This is usually going to be located in an init block executed early in the code to show it when the game loads up as a splash screen.
# image cred = Text(credits_s, font="myfont.ttf", text_align=0.5) #use this if you want to use special fonts
image cred = Text(credits_s, text_align=0.5)
image theend = Text("{size=80}The End", text_align=0.5)
image thanks = Text("{size=80}Thanks for Playing!", text_align=0.5)
$ credits_speed = 25 #scrolling speed in seconds
scene black #replace this with a fancy background
show cred at Move((0.5, 5.0), (0.5, 0.0), credits_speed, repeat=False, bounce=False, xanchor="center", yanchor="bottom")
show theend:
yanchor 0.5 ypos 0.5
xanchor 0.5 xpos 0.5
with dissolve
with Pause(5)
hide theend
with dissolve
with Pause(credits_speed - 5)
show splash2
with dissolve
with Pause(3)
hide splash2
with dissolve
with Pause(1)
show thanks:
yanchor 0.5 ypos 0.5
xanchor 0.5 xpos 0.5
with dissolve
with Pause(4)
hide thanks
with dissolve
return
init python:
credits = ('Backgrounds', 'Airgoof'), ('Backgrounds', 'Dorktwerp'), ('Sprites and CG', 'Ballclown'), ('GUI', 'Cuddlywad'), ('Writing', 'Dorktwerp'), ('Writing', 'Fingerpookie'), ('Programming', 'Dorktwerp'), ('Music', 'Grumblemuck'), ('Music', 'Headwookum')
credits_s = "{size=80}Game Title or Logo\n\n"
c1 = ''
for c in credits:
if not c1==c[0]:
credits_s += "\n{size=60}" + c[0] + "\n"
credits_s += "{size=40}" + c[1] + "\n"
c1=c[0]
credits_s += "\n{size=60}Engine\n{size=40}" + renpy.version()