Skip to content

Commit

Permalink
refactor(story): tidy variables
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Sep 28, 2024
1 parent eaa48b8 commit b150fd4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion game/story/inside/basement.rpy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
label basement:

if locked["basement"]:
if locked_basement:
scene bg door closed with dissolve

play sound locked
Expand Down
6 changes: 3 additions & 3 deletions game/story/inside/basement_door.rpy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
label basement_door:

if locked["basement"]:
if locked_basement:
scene bg door closed

if item.show("scroll"):
Expand All @@ -12,7 +12,7 @@ label basement_door:
"Unlock the door" if item.is_inventory("key"):
play sound unlocked

$ locked["basement"] = False
$ locked_basement = False
$ item.use("key")

player "The door is unlocked."
Expand All @@ -38,7 +38,7 @@ label basement_door:
"What do you want to do?"

"Go downstairs":
$ visits["basement"] += 1
$ visits_basement += 1
jump basement_room

"Go upstairs":
Expand Down
4 changes: 2 additions & 2 deletions game/story/inside/basement_room.rpy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
label basement_room(with_dissolve=True):

if visits["basement"] == 1:
if visits_basement == 1:
jump basement_room_first_visit

if night:
Expand All @@ -22,7 +22,7 @@ label basement_room(with_dissolve=True):
else:
scene bg basement light

if visits["basement"] > 1:
if visits_basement > 1:
show screen basement_book

menu:
Expand Down
4 changes: 2 additions & 2 deletions game/story/inside/kitchen.rpy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
label kitchen:

$ visits["kitchen"] += 1
$ visits_kitchen += 1

if night:
scene bg kitchen night with dissolve
Expand Down Expand Up @@ -69,7 +69,7 @@ screen basement_key():
idle "items/key.webp"
action Jump("basement_key_found")
at scale(0.2)
if visits["kitchen"] > 1:
if visits_kitchen > 1:
xpos 1384
ypos 428
at scale(0.3), delayed_blink(0, 1)
Expand Down
6 changes: 3 additions & 3 deletions game/story/inside/room.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ screen safe():
xpos 1170
ypos 520
at scale(0.1)
if locked["safe"]:
if locked_safe:
idle "items/safe_closed.webp"
action Jump("safe")
else:
idle "items/safe_open.webp"

if not locked["safe"] and item.show("necklace"):
if not locked_safe and item.show("necklace"):
use necklace

label safe:
if renpy.input("Enter safe passcode:", length=4) == "1111":
$ locked["safe"] = False
$ locked_safe = False
play sound unlocked
player "The safe opened."
else:
Expand Down
12 changes: 4 additions & 8 deletions game/story/variables.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ default item = Item()
default night = False

# rooms
default locked = {
"basement": True,
"safe": True,
}
default locked_basement = True
default locked_safe = True

default visits = {
"basement": 0,
"kitchen": 0,
}
default visits_basement = 0
default visits_kitchen = 0

# events
default event_meet_lord1 = False
Expand Down

0 comments on commit b150fd4

Please sign in to comment.