From: lbcmk <30442978+lbcmk@users.noreply.github.com> Date: Tue, 12 Jul 2022 22:26:23 +0000 (-0400) Subject: dialogue can now be turned into floating text X-Git-Url: http://git.skullheadx.com/index.js?a=commitdiff_plain;h=2f06a25411226ef852c8842ebedc242793ca1c83;p=Pygame-Jam.git dialogue can now be turned into floating text --- diff --git a/Game.py b/Game.py index ead45d6..6c90278 100644 --- 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) diff --git a/UI/Dialogue.py b/UI/Dialogue.py index 2cf5d45..4421f6a 100644 --- a/UI/Dialogue.py +++ b/UI/Dialogue.py @@ -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)):