from EndScreen import EndScreen
from UI.DashMeter import DashMeter
from UI.HealthBar import HealthBar
+from UI.PotionUI import PotionUI
from Function.Portal import Transition
self.scene = EndScreen()
self.dashMeter = DashMeter(self.player.dashCooldown)
self.healthBar = HealthBar()
+ self.potionUI = PotionUI()
self.level = 1
self.scene.level = self.level
self.dashMeter.update(self.player.lastDash)
self.dashMeter.draw(surf)
self.healthBar.draw(surf, self.player.health)
+ self.potionUI.draw(surf, self.player.potion_bag, self.player.potion_cooldown)
if self.player.dead:
self.scene.update()
import pygame.key
from Setup import *
+import time
from Actors import Actor
from datetime import datetime, timedelta
from Potion import Potion
# current_health_display = createText(0, 0, 30, white, "Regular", str(self.health) + "/100")[0]
# text_rect = current_health_display.get_rect(center=background_rect.center)
# surf.blit(current_health_display, text_rect)
+
+
+
+ def potion_cooldown_timer(self):
+ while self.potion_cooldown > 0:
+ self.potion_cooldown -= 1
+ print(self.potion_cooldown)
+ time.sleep(1)
+
+
from Setup import *
+import threading
class Potion:
def consume_potion(self, player):
player.health += self.heal
+ if player.health > 100:
+ player.health = 100
+
del player.potion_bag[0]
- player.potion_cooldown = 5
+ player.potion_cooldown = 30
+ threading.Thread(target = player.potion_cooldown_timer).start()
+
+
+
- #def cooldown(self, player):
-
--- /dev/null
+from Setup import *
+from Function.createText import createText
+from CommonImports.colours import white
+
+
+#Potion UI
+
+class PotionUI:
+
+ def __init__(self):
+ return;
+
+ def update(self):
+ return;
+
+ def draw(self, surf, potion_bag, potion_cooldown):
+ #Amount of Potions Display
+ num_of_potions = createText(0, 0, 30, white, "Regular", str(len(potion_bag)) + " Potions")[0]
+ potion_text_rect = num_of_potions.get_rect(left = 20, top = 70)
+ surf.blit(num_of_potions, potion_text_rect)
+
+ #Cooldown Display
+ if potion_cooldown > 0:
+ potion_cd_ui = createText(0, 0, 30, white, "Regular", str(potion_cooldown) + " until potion can be used")[0]
+ potion_cd_rect = num_of_potions.get_rect(left = 20, top = 100)
+ surf.blit(potion_cd_ui, potion_cd_rect)