diff --git "a/L\303\251o/Champs.py" "b/L\303\251o/Champs.py" old mode 100644 new mode 100755 index 037c2318a1bbee3e4c0809f31b93db04fc63000d..e022fbc84cf6e6ab8ab9af1e97c7f359fe7d529a --- "a/L\303\251o/Champs.py" +++ "b/L\303\251o/Champs.py" @@ -1,30 +1,36 @@ -import pygame - -police = pygame.font.SysFont("Alef", 18) #pygame.font.get_fonts() -> liste des fonts - -class Champs: - def __init__ (self, tempature, humidite, tempsAvantMaturation, pos, image): - self.temperature = tempature - self.humidite = humidite - self.TAM = tempsAvantMaturation - self.pos = pos - self.image = image - self.rect = pygame.rect.Rect(self.pos, self.image.get_rect().size) - - def showInfo (self, screen): - #afficher à l'endroit de self.x et self.y - text = police.render("Température : " + str(self.temperature), False, (0,0,0)) #prix d'achat si buisson - - pygame.draw.rect(screen, (255, 255, 255), pygame.rect.Rect(self.pos,(100,100))) - screen.blit(text, self.pos) - - def draw (self, screen): - screen.blit(self.image, self.pos) - -class Houblon (Champs): - def __init__ (self, pos): - super().__init__(0, 0, 0, pos, pygame.image.load('../assets/champ.png')) - -class Buisson (Champs): - def __init__ (self, pos): - super().__init__(0, 0, 0, pos, pygame.image.load('../assets/buisson.png')) \ No newline at end of file +import pygame + +police = pygame.font.SysFont("Alef", 22) #pygame.font.get_fonts() -> liste des fonts + +class Champs: + def __init__ (self, tempature, humidite, tempsAvantMaturation, pos, image): + self.temperature = tempature + self.humidite = humidite + self.TAM = tempsAvantMaturation + self.pos = pos + self.image = image + self.rect = pygame.rect.Rect(self.pos, self.image.get_rect().size) + + def draw (self, screen): + screen.blit(self.image, self.pos) + +class Houblon (Champs): + def __init__ (self, pos): + super().__init__(0, 0, 0, pos, pygame.image.load('../assets/champ.png')) + + def showInfo (self, screen): + text = police.render("Température : " + str(self.temperature), False, (0,0,0)) + + pygame.draw.rect(screen, (255, 255, 255), pygame.rect.Rect(self.pos, (self.rect.width*0.75, self.rect.height*0.75))) + screen.blit(text, self.pos) + +class Buisson (Champs): + def __init__ (self, pos, prix = 10000): + super().__init__(0, 0, 0, pos, pygame.image.load('../assets/buisson.png')) + self.prix = prix + + def showInfo (self, screen): + text = police.render("Champ disponible à l'achat : " + str(self.prix), False, (0,0,0)) + + pygame.draw.rect(screen, (255, 255, 255), pygame.rect.Rect(self.pos, (self.rect.width*0.75, self.rect.height*0.75))) + screen.blit(text, self.pos) diff --git "a/L\303\251o/Game.py" "b/L\303\251o/Game.py" old mode 100644 new mode 100755 index eba2e29e80e289387c6fc57051b987959a77e775..40e7087f73d7c080bc6f1b7f06bdad1af30c5ac4 --- "a/L\303\251o/Game.py" +++ "b/L\303\251o/Game.py" @@ -1,39 +1,49 @@ -import pygame -from Champs import * - -class Game: - def __init__ (self, screen): - self.screen = screen - self.score = 0 - self.money = 10000 - self.month = "janvier" - self.champs = [Buisson((0,0)),Houblon((800,500))] - self.clock = pygame.time.Clock() - self.selectedChamp = None - - def gameLoop (self): - while True: - self.screen.fill((0,0,0)) - isChamp = False - #ici il faudra charger les textures du jeu - for champ in self.champs: - champ.draw(self.screen) - - for event in pygame.event.get(): - if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: - exit() - elif event.type == pygame.MOUSEMOTION: - for champ in self.champs: - if champ.rect.contains(*event.pos,0,0): - self.selectedChamp = champ - isChamp = True - - if not isChamp: - self.selectedChamp = None - - if self.selectedChamp: - self.selectedChamp.showInfo(self.screen) - - - pygame.display.update() - self.clock.tick(60) \ No newline at end of file +import pygame +from Champs import * + +police = pygame.font.SysFont("Alef", 30) + +class Game: + def __init__ (self, screen): + self.screen = screen + self.score = 0 + self.money = 10000 + self.month = "janvier" + self.champs = [Houblon((100,100)), Houblon((400,100)), Houblon((700,100)), Houblon((100,300)), Houblon((400,300)), Houblon((700,300)), Houblon((100,500)), Houblon((400,500)), Buisson((700,500))] + self.clock = pygame.time.Clock() + self.selectedChamp = None + self.imageMoney = pygame.image.load("../assets/money.png") + + def gameLoop (self): + while True: + self.screen.fill((0,0,0)) + + isChamp = False + #ici il faudra charger les textures du jeu + for champ in self.champs: + champ.draw(self.screen) + + # somme ajoutée ou enlevée au-dessus puis s'ajoute + textMoney = police.render(str(self.money), True, (255,255,255)) + self.screen.blit(textMoney, (0, self.screen.get_height()-textMoney.get_height()*2)) + self.screen.blit(self.imageMoney, (textMoney.get_width(), self.screen.get_height()-self.imageMoney.get_height())) + + + for event in pygame.event.get(): + if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: + exit() + elif event.type == pygame.MOUSEMOTION: + for champ in self.champs: + if champ.rect.contains(*event.pos,0,0): + self.selectedChamp = champ + isChamp = True + + if not isChamp: + self.selectedChamp = None + + if self.selectedChamp: + self.selectedChamp.showInfo(self.screen) + + + pygame.display.update() + self.clock.tick(60) diff --git "a/L\303\251o/T3.py" "b/L\303\251o/T3.py" old mode 100644 new mode 100755 index d30eaa3defa79f9731b2937c74b774d79aa57309..55d487cf6519b79014860c15a99e1e41765e042b --- "a/L\303\251o/T3.py" +++ "b/L\303\251o/T3.py" @@ -1,63 +1,62 @@ -import pygame, time -pygame.init() - -from datetime import date -import Game - -pygame.display.set_caption("Climate Simulator : Global Organization") -screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN) - -#on récupère le mois actuelle pour le faire commencer à ce moment -class month: - def __init__ (self, str): - self.month = str - -current_month = month(date.today().strftime("%b")) - -#background (2è scène) -background = pygame.image.load('../assets/accueil.jpg') -background = pygame.transform.scale(background, (screen.get_width(), screen.get_height())) - -#bannière -banner = pygame.image.load('../assets/banner.png') -banner = pygame.transform.scale(banner, (500,500)) -banner_rect = banner.get_rect() -banner_rect.x = screen.get_width() / 4 - -#bouton -play_button = pygame.image.load('../assets/button.png') -play_button = pygame.transform.scale(play_button,(400,150)) -play_button_rect = play_button.get_rect() -play_button_rect.x = screen.get_width() / 2.8 -play_button_rect.y = screen.get_height() / 2.4 - -#buisson -bush = pygame.image.load('../assets/buisson.png') - -#cadenas -lock = pygame.image.load('../assets/cadenas.png') - -screen.blit(background, (0,0)) -screen.blit(play_button, play_button_rect) - -screen.blit(bush, (100,100)) -screen.blit(lock, (bush.get_width()/2,bush.get_height()/2+40)) - -pygame.display.update() - -inMenu = True -while inMenu: - for event in pygame.event.get(): - if event.type == pygame.MOUSEBUTTONDOWN and play_button_rect.contains(*event.pos,0,0): - print("LANCEMENT") - inMenu = False - elif event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: - exit(0) - -Game.Game(screen).gameLoop() - -#après l'appui de start -#time.sleep(2) -#screen.fill((0,0,0)) -#pygame.display.flip() +import pygame, time +pygame.init() + +from datetime import date +import Game + +pygame.display.set_caption("Climate Simulator : Global Organization") +screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN) + +#on récupère le mois actuelle pour le faire commencer à ce moment +class month: + def __init__ (self, str): + self.month = str + +current_month = month(date.today().strftime("%b")) + +#background (2è scène) +background = pygame.image.load('../assets/accueil.jpg') +background = pygame.transform.scale(background, (screen.get_width(), screen.get_height())) + +#bannière +banner = pygame.image.load('../assets/banner.png') +banner = pygame.transform.scale(banner, (500,500)) +banner_rect = banner.get_rect() +banner_rect.x = screen.get_width() / 4 + +#bouton +play_button = pygame.image.load('../assets/button.png') +play_button = pygame.transform.scale(play_button,(400,150)) +play_button_rect = play_button.get_rect() +play_button_rect.x = screen.get_width() / 2.8 +play_button_rect.y = screen.get_height() / 2.4 + +#buisson +bush = pygame.image.load('../assets/buisson.png') + +#cadenas +lock = pygame.image.load('../assets/cadenas.png') + +screen.blit(background, (0,0)) +screen.blit(play_button, play_button_rect) + +#screen.blit(bush, (100,100)) +#screen.blit(lock, (bush.get_width()/2,bush.get_height()/2+40)) + +pygame.display.update() + +inMenu = True +while inMenu: + for event in pygame.event.get(): + if event.type == pygame.MOUSEBUTTONDOWN and play_button_rect.contains(*event.pos,0,0): + inMenu = False + elif event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: + exit(0) + +Game.Game(screen).gameLoop() + +#après l'appui de start +#time.sleep(2) +#screen.fill((0,0,0)) +#pygame.display.flip() #time.sleep(2) \ No newline at end of file diff --git "a/L\303\251o/Temps.py" "b/L\303\251o/Temps.py" old mode 100644 new mode 100755 index 364905b907ec267eda3e2b7abce89ab9932c473b..7b93dccb9aa7b58b7483133eee7bd49390f8f671 --- "a/L\303\251o/Temps.py" +++ "b/L\303\251o/Temps.py" @@ -1,58 +1,58 @@ -import random - -class Temps: - climats = { - "janvier" : { - "temp" : [20,40], - "humidité" : [0,10] - }, - "février" : { - - }, - "mars" : { - - }, - "avril" : { - - }, - "mai" : { - - }, - "juin" : { - - }, - "juillet" : { - - }, - "août" : { - - }, - "septembre" : { - - }, - "octobre" : { - - }, - "novembre" : { - - }, - "décembre" : { - - } - } - - def _init_ (self): - self.temperature - self.humidite - self.neige - self.currentMonth = "janvier" - - def randomTemp (self): - intervalleTemp = self.climats[self.currentMonth]["temp"] - - return random.randint(*intervalleTemp) # *intervalleTemp = intervalleTemp[0], intervalleTemp[1] - - def randomHumidite (self): - intervalleHumidite = self.climats[self.currentMonth]["humidité"] - - return random.randint(*intervalleHumidite) +import random + +class Temps: + climats = { + "janvier" : { + "temp" : [20,40], + "humidité" : [0,10] + }, + "février" : { + + }, + "mars" : { + + }, + "avril" : { + + }, + "mai" : { + + }, + "juin" : { + + }, + "juillet" : { + + }, + "août" : { + + }, + "septembre" : { + + }, + "octobre" : { + + }, + "novembre" : { + + }, + "décembre" : { + + } + } + + def _init_ (self): + self.temperature + self.humidite + self.neige + self.currentMonth = "janvier" + + def randomTemp (self): + intervalleTemp = self.climats[self.currentMonth]["temp"] + + return random.randint(*intervalleTemp) # *intervalleTemp = intervalleTemp[0], intervalleTemp[1] + + def randomHumidite (self): + intervalleHumidite = self.climats[self.currentMonth]["humidité"] + + return random.randint(*intervalleHumidite) diff --git "a/L\303\251o/__pycache__/Champs.cpython-310.pyc" "b/L\303\251o/__pycache__/Champs.cpython-310.pyc" new file mode 100755 index 0000000000000000000000000000000000000000..12d6536b4202f04fe31dddc6292b731b81825794 Binary files /dev/null and "b/L\303\251o/__pycache__/Champs.cpython-310.pyc" differ diff --git "a/L\303\251o/__pycache__/Champs.cpython-39.pyc" "b/L\303\251o/__pycache__/Champs.cpython-39.pyc" old mode 100644 new mode 100755 index 127f3c39c396fcc1ff306e905315ddd012fdc539..ff137bda13dc2351b254840d28f35b8453cd60fe Binary files "a/L\303\251o/__pycache__/Champs.cpython-39.pyc" and "b/L\303\251o/__pycache__/Champs.cpython-39.pyc" differ diff --git "a/L\303\251o/__pycache__/Game.cpython-310.pyc" "b/L\303\251o/__pycache__/Game.cpython-310.pyc" new file mode 100755 index 0000000000000000000000000000000000000000..ce878e7575535c3639b4da82d7c8f0345adebb35 Binary files /dev/null and "b/L\303\251o/__pycache__/Game.cpython-310.pyc" differ diff --git "a/L\303\251o/__pycache__/Game.cpython-39.pyc" "b/L\303\251o/__pycache__/Game.cpython-39.pyc" old mode 100644 new mode 100755 index 6814f9763fe9b428fde3aa5e130d61a265cca475..018ab015f72bc5ca6b677eaac1de07bd76331735 Binary files "a/L\303\251o/__pycache__/Game.cpython-39.pyc" and "b/L\303\251o/__pycache__/Game.cpython-39.pyc" differ