]> Skullheadx's Git Forge - Pygame-Jam.git/commitdiff
Fix
authorlbcmk <30442978+lbcmk@users.noreply.github.com>
Wed, 13 Jul 2022 00:02:09 +0000 (20:02 -0400)
committerlbcmk <30442978+lbcmk@users.noreply.github.com>
Wed, 13 Jul 2022 00:02:09 +0000 (20:02 -0400)
UI/Dialogue.py

index b65f4247e0daed546866fe2fc8ff40c0e38d0890..0a0a7a6d45d53f249639cb7f4f5867faea55106d 100644 (file)
@@ -42,20 +42,25 @@ class DialogueUI:
 
         try:
             X, Y = 0, 0
-            if(self.dialogue_list[self.char][2][0] == -10000 and self.dialogue_list[self.char][2][1] == -10000):
-                X = get_display_point(agent.position)[0] + agent.width / 2
-                Y = get_display_point(agent.position)[1]
-            else:
-                X, Y = get_display_point((self.dialogue_list[self.char][2][0], self.dialogue_list[self.char][2][1]))
-
-                # print(get_display_point((X, Y)))
-                print(get_camera_offset()[0] + SCREEN_WIDTH/2, get_camera_offset()[1] + SCREEN_HEIGHT/2)
-            
-            if(ID == 0):
-                self.text = text
-                X, Y = get_display_point((Xt, Yt))
-            else:
-                self.text = self.dialogue_list[self.char][0]
+            try:
+                if(self.dialogue_list[self.char][2][0] == -10000 and self.dialogue_list[self.char][2][1] == -10000):
+                    X = get_display_point(agent.position)[0] + agent.width / 2
+                    Y = get_display_point(agent.position)[1]
+                else:
+                    X, Y = get_display_point((self.dialogue_list[self.char][2][0], self.dialogue_list[self.char][2][1]))
+
+                    # print(get_display_point((X, Y)))
+                    print(get_camera_offset()[0] + SCREEN_WIDTH/2, get_camera_offset()[1] + SCREEN_HEIGHT/2)
+            except:
+                pass;
+            try:
+                if(ID == 0):
+                    self.text = text
+                    X, Y = get_display_point((Xt, Yt))
+                else:
+                    self.text = self.dialogue_list[self.char][0]
+            except:
+                pass;
             self.checkTime()
             self.createDialogue()
 
@@ -96,9 +101,12 @@ class DialogueUI:
         return;
 
     def checkTime(self):
-        if(datetime.utcnow() - self.lastTextTime >= timedelta(seconds=self.dialogue_list[self.char][1])):
-            if(self.char +1 < len(self.dialogue_list)):
-                self.char = self.char + 1
-            else:
-                self.char = 0
-                self.dialogue_list = []
\ No newline at end of file
+        try:
+            if(datetime.utcnow() - self.lastTextTime >= timedelta(seconds=self.dialogue_list[self.char][1])):
+                if(self.char +1 < len(self.dialogue_list)):
+                    self.char = self.char + 1
+                else:
+                    self.char = 0
+                    self.dialogue_list = []
+        except:
+            pass;
\ No newline at end of file