Skip to content

Commit

Permalink
Issue Afterdie#7 , Arman Pani (2228103), document door.py
Browse files Browse the repository at this point in the history
  • Loading branch information
arman-pani committed Oct 2, 2023
1 parent 5590691 commit 56f527c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion screens/doors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from kivy.core.audio import SoundLoader
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
from kivy.core.audio import SoundLoader

from .screen_check import passcode, set_doors

Expand All @@ -10,24 +10,33 @@ class DoorsScreen(Screen):
verified = False

def increment_value(self, label_index):
# Increment the value of the label by 1
if(int(label_index.text) == 5):
label_index.text = "0"
else:
label_index.text = f"{int(label_index.text) + 1}"
# Verify the code entered by the user
DoorsScreen.verify(self)

def decrement_value(self, label_index):
# Decrement the value of the label by 1
if(int(label_index.text) == 0):
label_index.text = "5"
else:
label_index.text = f"{int(label_index.text) - 1}"
# Verify the code entered by the user
DoorsScreen.verify(self)

def verify(self):
# Check if the code entered by the user matches the passcode
code = passcode == int(self.ids.label_1.text + self.ids.label_2.text + self.ids.label_3.text + self.ids.label_4.text)
if not DoorsScreen.verified and code:
# Set the verified status to True
DoorsScreen.verified = True
# Update the splash screen
self.ids.splash_bg.opacity = 0
self.ids.splash_bg_after.opacity = 1
# Set the doors
set_doors()
# Play the sound
sound.play()

0 comments on commit 56f527c

Please sign in to comment.