]> Skullheadx's Git Forge - Pygame-Jam.git/commitdiff
dialogue can now be turned into floating text
authorlbcmk <30442978+lbcmk@users.noreply.github.com>
Tue, 12 Jul 2022 22:26:23 +0000 (18:26 -0400)
committerlbcmk <30442978+lbcmk@users.noreply.github.com>
Tue, 12 Jul 2022 22:26:23 +0000 (18:26 -0400)
Game.py
UI/Dialogue.py

diff --git a/Game.py b/Game.py
index ead45d6b6d5f955dca6f8f1939b13b0a3c365a5b..6c902788ba2f71c0c16a1dad61ffa1b4bd6554b5 100644 (file)
--- a/Game.py
+++ b/Game.py
@@ -176,14 +176,14 @@ class Game:
         if (self.level == 1):
 
             # self.dialogue.draw(surf, self.enemies[0], "enemy dialogue")
-            self.dialogue.draw(surf, self.player, "text1", 4, 1)
+            self.dialogue.draw(surf, self.player, "text1", 4, 1, 100, 200)
             self.dialogue.draw(surf, self.player, "text2", 3, 2)
             self.dialogue.draw(surf, self.player, "text3", 2, 3)
             self.dialogue.draw(surf, self.player, "text4", 1, 4)
             self.dialogue.draw(surf, self.player, "text5", 0.5, 5)
 
         if(self.level == 13):
-            self.dialogue.draw(surf, self.player, "text1", 4, 1)
+            self.dialogue.draw(surf, self.player, "text1", 4, 1, 325, 320)
             self.dialogue.draw(surf, self.player, "text2", 3, 2)
             self.dialogue.draw(surf, self.player, "text3", 2, 3)
             self.dialogue.draw(surf, self.player, "text4", 1, 4)
index 2cf5d459932938755096c7e9f76235ab5eaa267a..4421f6a7b327682fd22a94b4f2ba82876e86ddda 100644 (file)
@@ -24,23 +24,32 @@ class DialogueUI:
     def update(self):
         return;
 
-    def draw(self, surf, agent, text, sec, ID):
-        
+    def draw(self, surf, agent, text, sec, ID, Xt=-10000, Yt=-10000):
+
         if(not ID in self.IDS):
             temp = []
+            c = []
             self.PSA += sec
             temp.append(text)
             temp.append(self.PSA)
+            c.append(Xt)
+            c.append(Yt)
+            temp.append(c)
             self.IDS.append(ID)
             self.dialogue_list.append(temp)
 
         try:
-            self.text = self.dialogue_list[self.char][0]
-            self.checkTime()
+            X, Y = 0, 0
+            if(self.dialogue_list[self.char][2][0] == -10000 or 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((Xt, Yt))
 
-            X = get_display_point(agent.position)[0] + agent.width / 2
-            Y = get_display_point(agent.position)[1]
+            print(get_display_point(agent.position)[0] + agent.width / 2, get_display_point(agent.position)[1])
 
+            self.text = self.dialogue_list[self.char][0]
+            self.checkTime()
             self.createDialogue()
 
             for i in range(len(self.drawText)):