Removed useless things

This commit is contained in:
theo@manjaro 2021-11-25 14:01:58 +01:00
parent acb4ad11a3
commit 4bdc9d4b66
12 changed files with 126 additions and 522 deletions

View File

@ -17,11 +17,6 @@ class Game():
self.fps = 60
font = "gamedata/font.ttf"
self.fontfile = pygame.font.Font(font,25)
self.fontfilesmall = pygame.font.Font(font,18)
self.fontfilebig = pygame.font.Font(font,60)
self.logs = []
self.running = True

View File

@ -1,89 +0,0 @@
import gamedata.objects.base as base
class Button(base.BaseObject):
def __init__(self,x,y,game,w=100,h=64,folder="base",folderact="baseAct"):
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
self.text = "Hello"
self.spritenon = self.gensprite(w,h,folder)
self.spriteact = self.gensprite(w,h,folderact)
self.sfx = game.sound_lib["sfx/click.wav"]
self.trigger = False
self.collision = False
def click(self,game):
print("hello world ! ")
self.click = click
self.skip = False # Si je passe l'effet sonore de base
def gensprite(self,w,h,foldername):
game = self.game
# Initialisation des parties de sprites
sprites = {}
for i in ("middle","left","right","up","down","corner_ul","corner_ur","corner_dl","corner_dr"):
sprites[i] = game.sprite_lib["gui/button/"+foldername+"/"+i+".png"] # Je récupère tout les sprites correspondant aux boutons
basewidth = w-sprites["left"].get_width()-sprites["right"].get_width() # Largeur du sprite du milieu
baseheight = h-sprites["up"].get_height()-sprites["down"].get_height() # Hauteur du sprite du milieu
for i in ("left","right"):
sprites[i] = base.pygame.transform.scale(sprites[i],(sprites[i].get_width(),baseheight))
for i in ("up","down"):
sprites[i] = base.pygame.transform.scale(sprites[i],(basewidth,sprites[i].get_height()))
# Initialisation de son sprite
finalsprite = base.pygame.Surface((w,h))
# Bordures haut et bas
finalsprite.blit(sprites["up"],(sprites["left"].get_width(),0))
finalsprite.blit(sprites["down"],(sprites["left"].get_width(),sprites["up"].get_height()+baseheight))
# Bordures gauche et droite
finalsprite.blit(sprites["left"],(0,sprites["up"].get_height()))
finalsprite.blit(sprites["right"],(sprites["left"].get_width()+basewidth,sprites["up"].get_height()))
# Coins du bouton
# Coins du bas
sprites["corner_dr"] = base.pygame.transform.scale(sprites["corner_dr"],(sprites["right"].get_width(),sprites["down"].get_height()))
finalsprite.blit(sprites["corner_dr"],(sprites["left"].get_width()+basewidth,sprites["up"].get_height()+baseheight))
sprites["corner_dl"] = base.pygame.transform.scale(sprites["corner_dl"],(sprites["left"].get_width(),sprites["down"].get_height()))
finalsprite.blit(sprites["corner_dl"],(0,sprites["up"].get_height()+baseheight))
# Coins du haut
sprites["corner_ur"] = base.pygame.transform.scale(sprites["corner_ur"],(sprites["right"].get_width(),sprites["up"].get_height()))
finalsprite.blit(sprites["corner_ur"],(sprites["left"].get_width()+basewidth,0))
sprites["corner_ul"] = base.pygame.transform.scale(sprites["corner_ul"],(sprites["left"].get_width(),sprites["up"].get_height()))
finalsprite.blit(sprites["corner_ul"],(0,0))
# Sprite du milieu
finalsprite.blit(base.pygame.transform.scale(sprites["middle"],(basewidth,baseheight)),(sprites["left"].get_width(),sprites["up"].get_height()))
return finalsprite
def step(self):
game = self.game
# Je vérifie si mon curseur de souris est dans le rectangle de l'objet
self.collision = True
nb = len(self.rect)//2 # Le nombre de dimensions, dans ce cas 2
for i in range(nb):
self.collision = self.collision and self.rect[i]<=game.inputs["mouse"]["pos"][i]<=self.rect[i+nb]+self.rect[i]
if self.collision and game.inputs["mouse"]["click"]==1:
self.trigger = True
if self.trigger:
self.click(self,game)
if self.skip:
self.skip = False
else:
self.sfx.play()
self.trigger = False
def draw(self):
game = self.game
# J'utilise le sprite special selection quand j'ai la souris dessus
self.sprite = self.spritenon
if self.collision:
self.sprite = self.spriteact
super().draw()
# Affichage du texte centré
value = 150
if self.collision: # Eclaircissement du texte
value+=75
img = game.fontfile.render(self.text, False, [value]*4)
posx = self.rect[0]+self.rect[2]/2-img.get_width()/2
posy = self.rect[1]+self.rect[3]/2-img.get_height()/2
self.game.window.blit(img, (posx, posy))

View File

@ -1,37 +0,0 @@
from gamedata.objects.base import BaseObject
class Info(BaseObject):
def __init__(self,game,message,color=[255]*3,temps=1):
super().__init__(0,0,game,game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT)
self.timer = game.lib.Timer(temps)
self.depth = 999
self.txtSurface = game.fontfilebig.render(message,False,color)
self.blackSurface = game.pygame.Surface((game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT))
self.blackSurface.fill([0]*3)
self.blackSurface.set_alpha(100)
def step(self):
game = self.game
self.timer.tick(game.dt)
if self.timer.getloops()>1:
game.gameloop.delid(self.id)
def draw(self):
game = self.game
self.txtSurface.set_alpha(255)
self.blackSurface.set_alpha(255)
if self.timer.getloops()==1:
alpha = min(1,self.timer.getratio())
self.txtSurface.set_alpha(alpha*100)
self.blackSurface.set_alpha(alpha*255)
game.window.blit(self.blackSurface,[0,0])
game.lib.drawcenter(game,self.txtSurface,game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT/2)

View File

@ -1,17 +0,0 @@
from gamedata.objects.base import BaseObject
class FightManager(BaseObject):
def __init__(self,game):
super().__init__(0,0,game)
def step(self):
self.game.globals["players"] = self.game.gameloop.findname("Player")
self.game.globals["hitpose"] = False # Manage hitpose game-wise
for player in self.game.globals["players"]:
if player.hitpose:
self.game.globals["hitpose"] = True
break
def draw(self):
pass

View File

@ -58,19 +58,12 @@ class Player(Movable):
self.playerid = 0
self.teamid = self.playerid
self.hitpose = False
self.hitposeduration = 0.01
self.hitposetimer = game.lib.Timer(self.hitposeduration)
self.damage = 0
self.horkb = 0
self.verkb = 0
self.reducekb = 15
self.multkb = 1
self.attackstate = None
self.gravity = 15
self.maxgravity = 30
@ -126,150 +119,145 @@ class Player(Movable):
if self.leaptimer<0:
self.canfastfall = True
canmove = (abs(self.verkb)+1)*(abs(self.horkb)+1)<2
keys = self.game.inputs["keys"]
self.horspd = 0
if canmove:
if self.canmove:
self.horspd=(keys["right"]["pressed"]-keys["left"]["pressed"])*self.game.dt*self.speed
self.game.globals["timer"]+=self.game.dt
if self.game.inputs["keys"]["escape"]["timer"]==1:
self.game.globals["pause"] = True
p = Pause(self.game)
self.game.gameloop.summon(p)
if not self.game.globals["hitpose"]:
canmove = (abs(self.verkb)+1)*(abs(self.horkb)+1)<2
keys = self.game.inputs["keys"]
self.horspd = 0
if canmove:
if self.canmove:
self.horspd=(keys["right"]["pressed"]-keys["left"]["pressed"])*self.game.dt*self.speed
self.game.globals["timer"]+=self.game.dt
if self.game.inputs["keys"]["escape"]["timer"]==1:
self.game.globals["pause"] = True
p = Pause(self.game)
self.game.gameloop.summon(p)
if self.landingtimer<=0:
self.sprite = self.spritestill
else:
self.landingtimer-=self.game.dt
self.spriteindex = 0
if self.horspd != 0:
if self.landingtimer<=0:
self.sprite = self.spritestill
self.spriteindex+=self.horspd*self.animationspeed*self.game.dt
self.sprite = self.sprites[int(self.spriteindex)%len(self.sprites)]
self.flipx = self.horspd<0
else:
# Beeing hurt
self.sprite = self.spritehurt
self.onground = False
self.onceilling = False
if self.combotimer>=0:
self.combotimer-=self.game.dt*5
# Cancel fastfall if not enough speed
if abs(self.verspd)<5:
self.fastfall = 0
if self.checkcollisions(0,self.gravityway):
self.onground = True
self.combo = 0
self.leaptimer = self.leapmaxtimer
self.candash = True
self.canfastfall = True
if self.verspd!=0 and abs(self.verspd)/self.verspd==abs(self.gravityway)/self.gravityway:
self.sprite=self.spritelanding
self.landingtimer = self.maxlandtime
if self.fastfall:
self.fastfall = 0
# Spawns dust
self.game.addParticle(self.dustparticles,self.rect.right+4,self.rect.center[1]+self.rect[3]/2*self.gravityway,fps=25)
self.game.addParticle(self.dustparticles,self.rect.left-4,self.rect.center[1]+self.rect[3]/2*self.gravityway,fps=25)
self.slamsfx.play()
else:
self.landingtimer-=self.game.dt
self.spriteindex = 0
if self.horspd != 0:
if self.landingtimer<=0:
self.spriteindex+=self.horspd*self.animationspeed*self.game.dt
self.sprite = self.sprites[int(self.spriteindex)%len(self.sprites)]
self.flipx = self.horspd<0
self.landsfx.play()
if self.gravityway > 0:
self.verspd=min(0,self.verspd)
else:
# Beeing hurt
self.sprite = self.spritehurt
if self.attackstate:
self.attackstate(self) # Si je suis sur le sol
self.onground = False
self.onceilling = False
if self.combotimer>=0:
self.combotimer-=self.game.dt*5
# Cancel fastfall if not enough speed
if abs(self.verspd)<5:
self.fastfall = 0
if self.checkcollisions(0,self.gravityway):
self.onground = True
self.combo = 0
self.leaptimer = self.leapmaxtimer
self.candash = True
self.canfastfall = True
if self.verspd!=0 and abs(self.verspd)/self.verspd==abs(self.gravityway)/self.gravityway:
self.sprite=self.spritelanding
self.landingtimer = self.maxlandtime
if self.fastfall:
self.fastfall = 0
# Spawns dust
self.game.addParticle(self.dustparticles,self.rect.right+4,self.rect.center[1]+self.rect[3]/2*self.gravityway,fps=25)
self.game.addParticle(self.dustparticles,self.rect.left-4,self.rect.center[1]+self.rect[3]/2*self.gravityway,fps=25)
self.slamsfx.play()
else:
self.landsfx.play()
if self.gravityway > 0:
self.verspd=min(0,self.verspd)
else:
self.verspd=max(0,self.verspd)
self.verspd=max(0,self.verspd)
else:
self.verspd+=self.gravity*self.game.dt*self.gravityway
if self.gravityway>0:
self.verspd= min(self.maxgravity,self.verspd)
else:
self.verspd+=self.gravity*self.game.dt*self.gravityway
if self.gravityway>0:
self.verspd= min(self.maxgravity,self.verspd)
else:
self.verspd = max(-self.maxgravity,self.verspd)
if self.checkcollisions(0,-self.gravityway):
self.onceilling = True
if self.gravityway>0:
self.verspd= max(0,self.verspd) # Se cogne au plafond BONK
else:
self.verspd = min(0,self.verspd)
self.verspd = max(-self.maxgravity,self.verspd)
if self.checkcollisions(0,-self.gravityway):
self.onceilling = True
if self.gravityway>0:
self.verspd= max(0,self.verspd) # Se cogne au plafond BONK
else:
self.verspd = min(0,self.verspd)
# Jumping and falling sprites
if canmove and not self.onground:
verdir = self.verspd>0
gravdir = self.gravityway>0
if not self.fastfall:
if verdir != gravdir:
self.sprite=self.spritejumping
else:
self.sprite=self.spritefalling
# Jumping and falling sprites
if canmove and not self.onground:
verdir = self.verspd>0
gravdir = self.gravityway>0
if not self.fastfall:
if verdir != gravdir:
self.sprite=self.spritejumping
else:
self.sprite = self.spritelanding
self.sprite=self.spritefalling
else:
self.sprite = self.spritelanding
# Adding knockback
self.horspd+=self.horkb
self.verspd+=self.verkb
# Adding knockback
self.horspd+=self.horkb
self.verspd+=self.verkb
self.jumped = False
if self.onground or self.leaptimer<0:
if self.canmove and 0<keys["up"]["timer"]<=3:
self.verspd= self.jump*self.gravityway
if self.leaptimer<0 and not self.onground:
self.verspd = -abs(self.verspd) # Small leap
self.leaptimer = 1
self.jumpsfx.play()
self.jumped = True
super().step() # Actually move
if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]:
self.jumped = False
if self.onground or self.leaptimer<0:
if self.canmove and 0<keys["up"]["timer"]<=3:
self.verspd= self.jump*self.gravityway
if self.leaptimer<0 and not self.onground:
self.verspd = -abs(self.verspd) # Small leap
self.leaptimer = 1
self.jumpsfx.play()
self.jumped = True
super().step() # Actually move
if self.rect.center[1]>self.game.globals["cameray"]+self.game.globals["camerah"]:
self.die()
for i in self.spikes:
if i.collidepoint(self.rect.center):
self.die()
for i in self.spikes:
if i.collidepoint(self.rect.center):
self.die()
# Updated hitrect
self.hitrect[0] = self.rect.center[0]-self.hitrect[2]/2
offset = 0
if self.verspd>0:
offset = 1
elif self.verspd<0:
offset = -1
self.canhit = abs(self.verspd)>2
self.hitrect[1] = self.rect.center[1]-self.hitrect[3]/2+10*offset
# Updated hitrect
self.hitrect[0] = self.rect.center[0]-self.hitrect[2]/2
offset = 0
if self.verspd>0:
offset = 1
elif self.verspd<0:
offset = -1
self.canhit = abs(self.verspd)>2
self.hitrect[1] = self.rect.center[1]-self.hitrect[3]/2+10*offset
# Reducing the knockback
if self.horkb>0:
self.horkb -= self.reducekb*self.game.dt
self.horkb = max(0,self.horkb)
if self.horkb<0:
self.horkb += self.reducekb*self.game.dt
self.horkb = min(0,self.horkb)
if self.verkb>0:
self.verkb = max(0,self.verkb-self.reducekb)*self.game.dt
if self.verkb<0:
self.verkb = min(0,self.verkb+self.reducekb)*self.game.dt
# Reducing the knockback
if self.horkb>0:
self.horkb -= self.reducekb*self.game.dt
self.horkb = max(0,self.horkb)
if self.horkb<0:
self.horkb += self.reducekb*self.game.dt
self.horkb = min(0,self.horkb)
if self.verkb>0:
self.verkb = max(0,self.verkb-self.reducekb)*self.game.dt
if self.verkb<0:
self.verkb = min(0,self.verkb+self.reducekb)*self.game.dt
# Je passe en dessous des semi-plateformes
if self.canmove and keys["down"]["timer"]==1:
falled = False
if not self.checkcollisions(0,1,semi=False):
semi = self.checkcollisions(0,1,classic=False)
if semi!=self.checkcollisions(0,0,classic=False) and semi:
self.rect.bottom = semi.top+1
falled = True
if not falled: # Check for fastfall
if self.canfastfall and not self.onground:
self.verspd = self.maxgravity/5
if self.leaptimer>0:
self.verspd*=self.gravityway
else:
self.leaptimer = 1
self.canfastfall = False
self.fastfall = self.gravityway
# Je passe en dessous des semi-plateformes
if self.canmove and keys["down"]["timer"]==1:
falled = False
if not self.checkcollisions(0,1,semi=False):
semi = self.checkcollisions(0,1,classic=False)
if semi!=self.checkcollisions(0,0,classic=False) and semi:
self.rect.bottom = semi.top+1
falled = True
if not falled: # Check for fastfall
if self.canfastfall and not self.onground:
self.verspd = self.maxgravity/5
if self.leaptimer>0:
self.verspd*=self.gravityway
else:
self.fastfall = False
self.leaptimer = 1
self.canfastfall = False
self.fastfall = self.gravityway
else:
self.fastfall = False
else:
self.deathtimer.tick(self.game.dt)

View File

@ -1,32 +0,0 @@
import gamedata.objects.menu.menu as menu
class MainMenu(menu.Menu):
def __init__(self,x,y,game,w=100,h=100):
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
# Les dicos des boutons
def fnPlay(self,game):
game.scene = game.scenes.fight
btnPlay = {"name":"Jouer","function":fnPlay}
def fnOptions(self,game):
game.scene = game.scenes.options
btnOptions= {"name":"Options","function": fnOptions}
def fnQuitter(self,game):
game.running = False
btnQuitter= {"name":"Quitter","function": fnQuitter}
# L'espacement
self.vpadding = 20
self.hpadding = 20
# Initialisation de la grille du menu
self.grid = [
[btnPlay],
[btnOptions],
[btnQuitter]
]
self.create(self.grid,self.rect)
def draw(self):
# affiche le titre du jeu
self.game.window.blit(self.game.sprite_lib["gui/title.png"],(0,self.baserect[1]-self.game.DISPLAY_HEIGHT/8))

View File

@ -1,51 +0,0 @@
import gamedata.objects.base as base
import gamedata.objects.button as button
class Menu(base.BaseObject):
def __init__(self,x,y,game,w=100,h=100):
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
self.init = False
# Initialisation de son sprite
self.sprite = None
# Variables de styles
self.hpadding = 2 # Les espaces entre les différents boutons
self.vpadding = 2
# Liste qui se remplira avec les objets bouttons
self.lbuttons = []
# Les dicos des boutons
def fnExemple(self,game):
print("Exemple")
btnExemple = {"name":"Bouton !!","function": fnExemple}
# Initialisation de la grille du menu
self.grid = [
[btnExemple],
[btnExemple,None]
]
def create(self,grid,rect):
game = self.game
elementheight = (rect[3]-(len(grid)-1)*self.vpadding)//len(grid)
for i in range(len(grid)):
elementwidth = (rect[2]-(len(grid[i])-1)*self.hpadding)//len(grid[i])
for j in range(len(grid[i])):
posx = rect[0]+j*(elementwidth+self.hpadding)
posy = rect[1]+i*(elementheight+self.vpadding)
if type(grid[i][j]).__name__=="dict":
# Si c'est un dico, l'emplacement est un bouton
folder = "base"
if "folder" in grid[i][j].keys():
folder = grid[i][j]["folder"]
btn = button.Button(posx,posy,game,elementwidth,elementheight,folder)
btn.text = grid[i][j]["name"]
btn.click = grid[i][j]["function"]
btn.menuowner = self # Le bouton a une référence à son menu
self.lbuttons.append(btn) # Je le garde en memoire
game.gameloop.summon(btn)
if type(grid[i][j]).__name__ in ("tuple","list"):
# Sinon, c'est une sous-grille
self.create(grid[i][j],[posx,posy,elementwidth,elementheight],game)

View File

@ -1,16 +0,0 @@
import gamedata.objects.menu.menu as menu
class OptionMenu(menu.Menu):
def __init__(self,x,y,game,w=100,h=100):
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
# Les dicos des boutons
def fnRetour(self,game):
game.scene = game.scenes.main
btnRetour= {"name":"Retour","function": fnRetour}
# Initialisation de la grille du menu
self.grid = [
[btnRetour]
]
self.create(self.grid,self.rect)

View File

@ -1,16 +0,0 @@
from gamedata.objects.sliders.slider import Slider
class BGMSlider(Slider):
def __init__(self,x,y,game,w=100,h=64,folder="base"):
super().__init__(x,y,game,w,h,folder) # initialise l'objet de base avec les bons arguments
self.currentvalue = self.getvalue()
self.posttext = " % Musique"
def change(self):
self.game.globals["bgmvolume"] = self.currentvalue/100
self.game.reinit_volumes()
def getvalue(self):
return self.game.globals["bgmvolume"]*100

View File

@ -1,16 +0,0 @@
from gamedata.objects.sliders.slider import Slider
class SFXSlider(Slider):
def __init__(self,x,y,game,w=100,h=64,folder="base"):
super().__init__(x,y,game,w,h,folder) # initialise l'objet de base avec les bons arguments
self.currentvalue = self.getvalue()
self.posttext = " % Effets Sonores"
def change(self):
self.game.globals["sfxvolume"] = self.currentvalue/100
self.game.reinit_volumes()
def getvalue(self):
return self.game.globals["sfxvolume"]*100

View File

@ -1,79 +0,0 @@
import gamedata.objects.base as base
class Slider(base.BaseObject):
def __init__(self,x,y,game,w=100,h=64,folder="base"):
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
self.posttext = " %"
self.max = 100
self.currentvalue = self.getvalue()
self.bgsprite = self.gensprite(w,h,folder)
self.sprite = game.pygame.transform.scale(game.sprite_lib["gui/slider/"+folder+"/circle.png"],(h,h))
self.maxwidth = w-h
self.rect = [self.getvalue()/self.max*(self.maxwidth)+self.baserect[0],self.baserect[1],h,h]
self.sfx = game.sound_lib["sfx/click.wav"]
self.dragged = False
def change(self):
print("Value : "+self.currentvalue)
def getvalue(self):
return self.game.globals["sfxvolume"]*100
def postovalue(self):
self.currentvalue = (self.rect[0]-self.baserect[0])/(self.maxwidth)*self.max
def gensprite(self,w,h,folder):
game = self.game
left = game.sprite_lib["gui/slider/"+folder+"/left.png"]
left = game.pygame.transform.scale(left,(round(h/left.get_height()*left.get_width()),h))
right = game.sprite_lib["gui/slider/"+folder+"/right.png"]
right = game.pygame.transform.scale(right,(round(h/right.get_height()*right.get_width()),h))
middle = game.sprite_lib["gui/slider/"+folder+"/middle.png"]
middle = game.pygame.transform.scale(middle,(w-left.get_width()-right.get_width(),h))
surface = game.pygame.Surface((w,h),game.pygame.SRCALPHA)
surface.blit(left,(0,0))
surface.blit(middle,(left.get_width(),0))
surface.blit(right,(left.get_width()+middle.get_width(),0))
return surface
def step(self):
game = self.game
if self.rect[0]<=game.inputs["mouse"]["pos"][0]+game.globals["camerax"]<=self.rect[0]+self.rect[2]:
if self.rect[1]<=game.inputs["mouse"]["pos"][1]+game.globals["cameray"]<=self.rect[1]+self.rect[3]:
if game.inputs["mouse"]["click"]>1:
self.rect[0] = game.inputs["mouse"]["pos"][0]+game.globals["camerax"]-self.rect[3]/2
self.rect[0] = min(self.rect[0],self.baserect[0]+self.maxwidth)
self.rect[0] = max(self.rect[0],self.baserect[0])
self.dragged = True
self.postovalue()
if self.dragged and game.inputs["mouse"]["click"]==0:
# Le slider a été laché
self.change()
self.dragged = False
def draw(self):
game = self.game
game.window.blit(self.bgsprite,(self.baserect[0]-game.globals["camerax"],self.baserect[1]-game.globals["cameray"]))
game.window.blit(self.sprite,(self.rect[0]-game.globals["camerax"],self.rect[1]-game.globals["cameray"]))
txt = game.fontfile.render(str(round(self.currentvalue))+self.posttext,False,[255]*3)
px = self.baserect[0]+self.baserect[2]+50-game.globals["camerax"]
py = self.rect[1]+self.rect[3]/2-txt.get_height()/2-game.globals["camerax"]
game.window.blit(txt,[px,py])

View File

@ -1,24 +1,8 @@
from gamedata.objects.menu.mainmenu import MainMenu
from gamedata.objects.bg.movingbackground import MovingBackground
from gamedata.objects.bg.menubackground import MenuBackground
from gamedata.objects.menu.optionmenu import OptionMenu
from gamedata.objects.sliders.bgmslider import BGMSlider
from gamedata.objects.sliders.sfxslider import SFXSlider
from gamedata.objects.ingame.player import Player
from gamedata.objects.ingame.manager import FightManager
from gamedata.objects.ingame.hitbox import Hitbox
from gamedata.objects.ingame.tileset import TilesetRenderer
from gamedata.objects.ingame.water import Water
from gamedata.objects.results import Results
def main(game):
game.scaleCamera()
game.gameloop.reinit() # Je réinitialis la boucle
bg = MenuBackground(game)
menu = MainMenu(game.DISPLAY_WIDTH/4,round(game.DISPLAY_HEIGHT*3/8),game,game.DISPLAY_WIDTH//2,game.DISPLAY_HEIGHT//2)
game.gameloop.summon(bg)
game.gameloop.summon(menu)
def ingame(game,level="Level 2"):
game.scaleCamera(416,234)
game.globals["camerax"] = 0
@ -38,13 +22,3 @@ def overworld(game):
game.gameloop.reinit()
tileset = TilesetRenderer(0,0,game,"Overworld")
game.gameloop.summon(tileset)
def options(game):
game.gameloop.reinit()
game.globals["camerax"] = 0
game.globals["cameray"] = 0
s = BGMSlider(40,40,game,400,40)
s2 = SFXSlider(40,100,game,400,40)
menu = OptionMenu(round(game.DISPLAY_WIDTH/8),round(game.DISPLAY_HEIGHT*9/10),game,round(game.DISPLAY_WIDTH*6/8),round(game.DISPLAY_HEIGHT/10-game.DISPLAY_HEIGHT/30))
game.gameloop.summon(s)
game.gameloop.summon(s2)