From 6cf36a5bc89d079a3c93aee191666ab18adabb34 Mon Sep 17 00:00:00 2001 From: Apologieze <47333595+Apologieze@users.noreply.github.com> Date: Mon, 23 May 2022 10:04:40 +0200 Subject: [PATCH] New comment and small improvement --- coinflip.py | 4 +++- crash.py | 21 +++++++++------------ launcher.py | 1 + scene.py | 2 +- value.json | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/coinflip.py b/coinflip.py index 78ddbf6..7880666 100644 --- a/coinflip.py +++ b/coinflip.py @@ -3,6 +3,7 @@ from random import randint import json class Gen: + """A class that generate the coinflip game""" def crea(self, tempres, fullscreen): self.DEBUG = True self.FULLSCREEN = fullscreen @@ -115,7 +116,6 @@ class Button(): self.receiver.reset_text() def update(self): - #color = self.color_active if self.rect.collidepoint(pos) and not mou[0] else self.color_passive if self.rect.collidepoint(gen.pos): if gen.mou[0]: color = self.color_passive @@ -302,6 +302,7 @@ class GUI(): gen.screen.blit(self.text_screen, self.text_screen_rect) def change_balance(n): + """Change the in game balance and the local balance file""" temp = str(gen.balance+n).split('.') gen.balance = round(float(temp[0]) + float("0." + temp[1][:min(2, len(temp[1]))]), 2) gen.gui.display_balance.resize() @@ -310,6 +311,7 @@ def change_balance(n): def init(tempres, fullscreen): + """Function used to start the game""" global gen gen = Gen() gen.crea(tempres, fullscreen) diff --git a/crash.py b/crash.py index 7cdb40a..a337d9c 100644 --- a/crash.py +++ b/crash.py @@ -1,17 +1,14 @@ import pygame as pg -from sys import exit -import ctypes as ct from random import randint import json class Gen(): + """A class that generate the crash game""" def crea(self, tempres, fullscreen): self.DEBUG = False self.FULLSCREEN = fullscreen self.CHANGESCENE = 0 self.running = False - # pg.init() - #screen_width, screen_height = Tk().winfo_screenwidth(), Tk().winfo_screenheight() self.tempres = tempres self.res = tempres[0] if self.FULLSCREEN else tempres[1] self.mid_screen = (self.res[0] // 2, self.res[1] // 2) @@ -41,7 +38,7 @@ class Gen(): self.courbe = Courbe() self.gui = Gui(self.game_state) - self.historic = Historic() + self.history = History() self.timer = Timer() @@ -87,7 +84,7 @@ class Gen(): self.gui.update() - self.historic.update() + self.history.update() self.rocket.draw(self.screen) self.rocket.update() @@ -168,7 +165,7 @@ class Rocket(pg.sprite.Sprite): if self.fall_index < 50: if self.fall_index == 0: new_round() - gen.historic.add_value(self.multi_max,self.multi_color) + gen.history.add_value(self.multi_max,self.multi_color) self.multi_color = "#ff0000" self.explosion.play() self.fall_index += 1 @@ -420,7 +417,8 @@ class Timer(): pg.mixer.music.play() self.reset() -class Historic(): +class History(): + """Show the last multipliers""" def __init__(self): self.text_list = [] self.rect_list = [] @@ -453,7 +451,7 @@ def new_round(): gen.gui.reset_live_bet() def change_balance(n): - # gen.game_state.balance += n + """Change the in game balance and the local balance file""" temp = str(gen.game_state.balance+n).split('.') gen.game_state.balance = round(float(temp[0]) + float("0." + temp[1][:min(2, len(temp[1]))]), 2) with open('value.json', 'w') as json_file: @@ -465,8 +463,7 @@ def rocket_video_reset(h): def init(tempres, fullscreen): + """Function used to start the game""" global gen gen = Gen() - gen.crea(tempres, fullscreen) - - + gen.crea(tempres, fullscreen) \ No newline at end of file diff --git a/launcher.py b/launcher.py index cbe8313..0fb12f3 100644 --- a/launcher.py +++ b/launcher.py @@ -4,6 +4,7 @@ import ctypes as ct import json class Gen: + """A class that generate the launcher to launch game""" def crea(self, tempres, fullscreen): self.DEBUG = True self.FULLSCREEN = fullscreen diff --git a/scene.py b/scene.py index f1a870d..779d524 100644 --- a/scene.py +++ b/scene.py @@ -4,7 +4,7 @@ import coinflip import pygame as pg class Scene(): - """Gestionnaire des différentes scène qui permet de naviguer facilement entre les différents jeu et le launcher""" + """Scene Manager that allows you to easily navigate between the different games and the launcher""" def change_scene(self,nb): self.current_scene = self.scenes[nb-1] self.current_scene.init(self.res, self.FULLSCREEN) diff --git a/value.json b/value.json index f2cca94..aa1228f 100644 --- a/value.json +++ b/value.json @@ -1 +1 @@ -{"balance": 100.0} \ No newline at end of file +{"balance": 99.6} \ No newline at end of file