Ajout d'une grille simpliste
This commit is contained in:
parent
32e33947fe
commit
92e3ac2a25
BIN
gamedata/assets/solid.png
Normal file
BIN
gamedata/assets/solid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
@ -4,14 +4,15 @@ class BaseObject():
|
|||||||
def __init__(self,x,y,game,w=10,h=10):
|
def __init__(self,x,y,game,w=10,h=10):
|
||||||
self.rect = [x,y,w,h]
|
self.rect = [x,y,w,h]
|
||||||
self.baserect = self.rect.copy()
|
self.baserect = self.rect.copy()
|
||||||
|
self.game = game
|
||||||
self.sprite = game.sprite_lib["icon.png"]
|
self.sprite = game.sprite_lib["icon.png"]
|
||||||
self.spriteoffset = 0,0
|
self.spriteoffset = 0,0
|
||||||
self.depth = 1 # Sa "profondeur", déterminera l'odre d'affichage des objets
|
self.depth = 1 # Sa "profondeur", déterminera l'odre d'affichage des objets
|
||||||
|
|
||||||
def step(self,game):
|
def step(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self):
|
||||||
if self.sprite:
|
if self.sprite:
|
||||||
game.window.blit(self.sprite,self.rect[:2])
|
self.game.window.blit(self.sprite,self.rect[:2])
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@ class BackgroundDrawer(BaseObject):
|
|||||||
super().__init__(x,y,game,w,h)
|
super().__init__(x,y,game,w,h)
|
||||||
self.ratio = ratio
|
self.ratio = ratio
|
||||||
self.depth = -1
|
self.depth = -1
|
||||||
self.fill(sprite,game) # Générer notre sprite de l'objet, le remplissant avec le sprite argument
|
self.fill(sprite) # Générer notre sprite de l'objet, le remplissant avec le sprite argument
|
||||||
|
|
||||||
def fill(self,sprite,game):
|
def fill(self,sprite):
|
||||||
|
game = self.game
|
||||||
self.tilew = sprite.get_width()
|
self.tilew = sprite.get_width()
|
||||||
self.tileh = sprite.get_height()
|
self.tileh = sprite.get_height()
|
||||||
nbw = round(self.rect[2]/self.tilew+1.5)
|
nbw = round(self.rect[2]/self.tilew+1.5)
|
||||||
@ -21,7 +22,8 @@ class BackgroundDrawer(BaseObject):
|
|||||||
for j in range(nbh):
|
for j in range(nbh):
|
||||||
self.sprite.blit(sprite,(i*self.tilew,j*self.tileh))
|
self.sprite.blit(sprite,(i*self.tilew,j*self.tileh))
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self):
|
||||||
|
game = self.game
|
||||||
# Affichage du sprite de mannière répétée
|
# Affichage du sprite de mannière répétée
|
||||||
px = (self.rect[0]-game.globals["camerax"]*self.ratio)%self.tilew
|
px = (self.rect[0]-game.globals["camerax"]*self.ratio)%self.tilew
|
||||||
py = (self.rect[1]-game.globals["cameray"]*self.ratio)%self.tileh
|
py = (self.rect[1]-game.globals["cameray"]*self.ratio)%self.tileh
|
||||||
|
@ -9,13 +9,15 @@ class MenuBackground(BackgroundDrawer):
|
|||||||
shadow = game.sprite_lib["shadow.png"]
|
shadow = game.sprite_lib["shadow.png"]
|
||||||
self.shadow = game.pygame.transform.scale(shadow,(1500,1500)) # J'augmente la taille de l'ombre
|
self.shadow = game.pygame.transform.scale(shadow,(1500,1500)) # J'augmente la taille de l'ombre
|
||||||
|
|
||||||
def step(self,game):
|
def step(self):
|
||||||
super().step(game)
|
game = self.game
|
||||||
|
super().step()
|
||||||
destx = (game.inputs["mouse"]["pos"][0]-game.DISPLAY_WIDTH/2)
|
destx = (game.inputs["mouse"]["pos"][0]-game.DISPLAY_WIDTH/2)
|
||||||
desty = (game.inputs["mouse"]["pos"][1]-game.DISPLAY_HEIGHT/2)
|
desty = (game.inputs["mouse"]["pos"][1]-game.DISPLAY_HEIGHT/2)
|
||||||
game.globals["camerax"] += (destx-game.globals["camerax"])/6
|
game.globals["camerax"] += (destx-game.globals["camerax"])/6
|
||||||
game.globals["cameray"] += (desty-game.globals["cameray"])/6
|
game.globals["cameray"] += (desty-game.globals["cameray"])/6
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self):
|
||||||
super().draw(game)
|
game = self.game
|
||||||
|
super().draw()
|
||||||
game.lib.drawcenter(game,self.shadow,game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT*3/5)
|
game.lib.drawcenter(game,self.shadow,game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT*3/5)
|
||||||
|
@ -7,6 +7,6 @@ class MovingBackground(BackgroundDrawer):
|
|||||||
self.spdx = spdx
|
self.spdx = spdx
|
||||||
self.spdy = spdy
|
self.spdy = spdy
|
||||||
|
|
||||||
def step(self,game):
|
def step(self):
|
||||||
self.rect[0]+=self.spdx
|
self.rect[0]+=self.spdx
|
||||||
self.rect[1]+=self.spdy
|
self.rect[1]+=self.spdy
|
||||||
|
@ -5,22 +5,21 @@ class Button(base.BaseObject):
|
|||||||
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
|
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
|
||||||
self.text = "Hello"
|
self.text = "Hello"
|
||||||
|
|
||||||
self.spritenon = self.gensprite(game,w,h,folder)
|
self.spritenon = self.gensprite(w,h,folder)
|
||||||
self.spriteact = self.gensprite(game,w,h,folderact)
|
self.spriteact = self.gensprite(w,h,folderact)
|
||||||
|
|
||||||
self.sfx = game.sound_lib["sfx/click.wav"]
|
self.sfx = game.sound_lib["sfx/click.wav"]
|
||||||
|
|
||||||
self.trigger = False
|
self.trigger = False
|
||||||
self.collision = False
|
self.collision = False
|
||||||
|
|
||||||
self.game = game
|
|
||||||
|
|
||||||
def click(self,game):
|
def click(self,game):
|
||||||
print("hello world ! ")
|
print("hello world ! ")
|
||||||
self.click = click
|
self.click = click
|
||||||
self.skip = False # Si je passe l'effet sonore de base
|
self.skip = False # Si je passe l'effet sonore de base
|
||||||
|
|
||||||
def gensprite(self,game,w,h,foldername):
|
def gensprite(self,w,h,foldername):
|
||||||
|
game = self.game
|
||||||
# Initialisation des parties de sprites
|
# Initialisation des parties de sprites
|
||||||
sprites = {}
|
sprites = {}
|
||||||
for i in ("middle","left","right","up","down","corner_ul","corner_ur","corner_dl","corner_dr"):
|
for i in ("middle","left","right","up","down","corner_ul","corner_ur","corner_dl","corner_dr"):
|
||||||
@ -54,7 +53,8 @@ class Button(base.BaseObject):
|
|||||||
# Sprite du milieu
|
# Sprite du milieu
|
||||||
finalsprite.blit(base.pygame.transform.scale(sprites["middle"],(basewidth,baseheight)),(sprites["left"].get_width(),sprites["up"].get_height()))
|
finalsprite.blit(base.pygame.transform.scale(sprites["middle"],(basewidth,baseheight)),(sprites["left"].get_width(),sprites["up"].get_height()))
|
||||||
return finalsprite
|
return finalsprite
|
||||||
def step(self,game):
|
def step(self):
|
||||||
|
game = self.game
|
||||||
# Je vérifie si mon curseur de souris est dans le rectangle de l'objet
|
# Je vérifie si mon curseur de souris est dans le rectangle de l'objet
|
||||||
self.collision = True
|
self.collision = True
|
||||||
nb = len(self.rect)//2 # Le nombre de dimensions, dans ce cas 2
|
nb = len(self.rect)//2 # Le nombre de dimensions, dans ce cas 2
|
||||||
@ -72,12 +72,13 @@ class Button(base.BaseObject):
|
|||||||
self.sfx.play()
|
self.sfx.play()
|
||||||
self.trigger = False
|
self.trigger = False
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self):
|
||||||
|
game = self.game
|
||||||
# J'utilise le sprite special selection quand j'ai la souris dessus
|
# J'utilise le sprite special selection quand j'ai la souris dessus
|
||||||
self.sprite = self.spritenon
|
self.sprite = self.spritenon
|
||||||
if self.collision:
|
if self.collision:
|
||||||
self.sprite = self.spriteact
|
self.sprite = self.spriteact
|
||||||
super().draw(game)
|
super().draw()
|
||||||
# Affichage du texte centré
|
# Affichage du texte centré
|
||||||
value = 150
|
value = 150
|
||||||
if self.collision: # Eclaircissement du texte
|
if self.collision: # Eclaircissement du texte
|
||||||
@ -85,4 +86,4 @@ class Button(base.BaseObject):
|
|||||||
img = game.fontfile.render(self.text, False, [value]*4)
|
img = game.fontfile.render(self.text, False, [value]*4)
|
||||||
posx = self.rect[0]+self.rect[2]/2-img.get_width()/2
|
posx = self.rect[0]+self.rect[2]/2-img.get_width()/2
|
||||||
posy = self.rect[1]+self.rect[3]/2-img.get_height()/2
|
posy = self.rect[1]+self.rect[3]/2-img.get_height()/2
|
||||||
game.window.blit(img, (posx, posy))
|
self.game.window.blit(img, (posx, posy))
|
||||||
|
7
gamedata/objects/combat/player.py
Normal file
7
gamedata/objects/combat/player.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from gamedata.objects.base import BaseObject
|
||||||
|
|
||||||
|
class Player(BaseObject):
|
||||||
|
|
||||||
|
def step(self):
|
||||||
|
keys = self.game.inputs["keys"]
|
||||||
|
self.rect[0]+=keys["right"]["pressed"]-keys["left"]["pressed"]
|
30
gamedata/objects/combat/tileset.py
Normal file
30
gamedata/objects/combat/tileset.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
from gamedata.objects.base import BaseObject
|
||||||
|
|
||||||
|
class TilesetRenderer(BaseObject):
|
||||||
|
|
||||||
|
def __init__(self,x,y,game):
|
||||||
|
|
||||||
|
super().__init__(x,y,game)
|
||||||
|
|
||||||
|
self.tilew = 64
|
||||||
|
self.tileh = 64
|
||||||
|
|
||||||
|
self.sprite = game.sprite_lib["solid.png"]
|
||||||
|
|
||||||
|
self.collisiongrid = [
|
||||||
|
[0,0,0,0,0,0,0],
|
||||||
|
[0,0,0,0,1,0,0],
|
||||||
|
[1,1,0,0,0,0,0],
|
||||||
|
[1,1,0,0,0,0,0],
|
||||||
|
[1,1,0,0,0,1,1],
|
||||||
|
[1,1,0,1,1,1,0],
|
||||||
|
]
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
|
||||||
|
for y in range(len(self.collisiongrid)):
|
||||||
|
for x in range(len(self.collisiongrid[y])):
|
||||||
|
|
||||||
|
data = self.collisiongrid[y][x]
|
||||||
|
if data==1:
|
||||||
|
self.game.window.blit(self.sprite,(self.rect[0]+x*self.tilew,self.rect[1]+y*self.tileh))
|
@ -40,7 +40,7 @@ class GameLoop():
|
|||||||
|
|
||||||
objs = list(self.objects.values())
|
objs = list(self.objects.values())
|
||||||
for i in objs:
|
for i in objs:
|
||||||
i.step(game)
|
i.step()
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self,game):
|
||||||
#Je secoue ma caméra
|
#Je secoue ma caméra
|
||||||
@ -55,7 +55,7 @@ class GameLoop():
|
|||||||
tri = lambda x: x.depth # Donne la profondeur de l'objet
|
tri = lambda x: x.depth # Donne la profondeur de l'objet
|
||||||
values.sort(key=tri)
|
values.sort(key=tri)
|
||||||
for i in values:
|
for i in values:
|
||||||
i.draw(game) # Lancer le script d'affichage de chaques objets
|
i.draw() # Lancer le script d'affichage de chaques objets
|
||||||
# Je stabilise la caméra
|
# Je stabilise la caméra
|
||||||
game.globals["camerax"]-=rx
|
game.globals["camerax"]-=rx
|
||||||
game.globals["cameray"]-=ry
|
game.globals["cameray"]-=ry
|
||||||
|
@ -15,14 +15,14 @@ class Info(BaseObject):
|
|||||||
self.blackSurface.fill([0]*3)
|
self.blackSurface.fill([0]*3)
|
||||||
self.blackSurface.set_alpha(100)
|
self.blackSurface.set_alpha(100)
|
||||||
|
|
||||||
def step(self,game):
|
def step(self):
|
||||||
|
game = self.game
|
||||||
self.timer.tick(game.dt)
|
self.timer.tick(game.dt)
|
||||||
if self.timer.getloops()>1:
|
if self.timer.getloops()>1:
|
||||||
game.gameloop.delid(self.id)
|
game.gameloop.delid(self.id)
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self):
|
||||||
|
game = self.game
|
||||||
self.txtSurface.set_alpha(255)
|
self.txtSurface.set_alpha(255)
|
||||||
self.blackSurface.set_alpha(255)
|
self.blackSurface.set_alpha(255)
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@ class MainMenu(menu.Menu):
|
|||||||
def __init__(self,x,y,game,w=100,h=100):
|
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
|
super().__init__(x,y,game,w,h) # initialise l'objet de base avec les bons arguments
|
||||||
# Les dicos des boutons
|
# Les dicos des boutons
|
||||||
|
def fnPlay(self,game):
|
||||||
|
game.scene = game.scenes.fight
|
||||||
|
btnPlay = {"name":"Jouer","function":fnPlay}
|
||||||
def fnOptions(self,game):
|
def fnOptions(self,game):
|
||||||
game.scene = game.scenes.options
|
game.scene = game.scenes.options
|
||||||
btnOptions= {"name":"Options","function": fnOptions}
|
btnOptions= {"name":"Options","function": fnOptions}
|
||||||
@ -17,12 +20,13 @@ class MainMenu(menu.Menu):
|
|||||||
|
|
||||||
# Initialisation de la grille du menu
|
# Initialisation de la grille du menu
|
||||||
self.grid = [
|
self.grid = [
|
||||||
|
[btnPlay],
|
||||||
[btnOptions],
|
[btnOptions],
|
||||||
[btnQuitter]
|
[btnQuitter]
|
||||||
]
|
]
|
||||||
|
|
||||||
self.create(self.grid,self.rect,game)
|
self.create(self.grid,self.rect)
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self):
|
||||||
# affiche le titre du jeu
|
# affiche le titre du jeu
|
||||||
game.window.blit(game.sprite_lib["gui/title.png"],(0,self.baserect[1]-game.DISPLAY_HEIGHT/8))
|
self.game.window.blit(self.game.sprite_lib["gui/title.png"],(0,self.baserect[1]-self.game.DISPLAY_HEIGHT/8))
|
||||||
|
@ -26,10 +26,9 @@ class Menu(base.BaseObject):
|
|||||||
[btnExemple],
|
[btnExemple],
|
||||||
[btnExemple,None]
|
[btnExemple,None]
|
||||||
]
|
]
|
||||||
|
|
||||||
#self.create(self.grid,self.rect,game)
|
def create(self,grid,rect):
|
||||||
|
game = self.game
|
||||||
def create(self,grid,rect,game):
|
|
||||||
elementheight = (rect[3]-(len(grid)-1)*self.vpadding)//len(grid)
|
elementheight = (rect[3]-(len(grid)-1)*self.vpadding)//len(grid)
|
||||||
for i in range(len(grid)):
|
for i in range(len(grid)):
|
||||||
elementwidth = (rect[2]-(len(grid[i])-1)*self.hpadding)//len(grid[i])
|
elementwidth = (rect[2]-(len(grid[i])-1)*self.hpadding)//len(grid[i])
|
||||||
|
@ -13,4 +13,4 @@ class OptionMenu(menu.Menu):
|
|||||||
[btnRetour]
|
[btnRetour]
|
||||||
]
|
]
|
||||||
|
|
||||||
self.create(self.grid,self.rect,game)
|
self.create(self.grid,self.rect)
|
||||||
|
@ -18,7 +18,9 @@ class Particle(BaseObject):
|
|||||||
|
|
||||||
self.alpha = 1
|
self.alpha = 1
|
||||||
|
|
||||||
def step(self,game):
|
def step(self):
|
||||||
|
|
||||||
|
game = self.game
|
||||||
|
|
||||||
for j in range(2):
|
for j in range(2):
|
||||||
self.rect[j]+=self.vel[j]*game.dt*60
|
self.rect[j]+=self.vel[j]*game.dt*60
|
||||||
@ -31,7 +33,9 @@ class Particle(BaseObject):
|
|||||||
self.alpha = max(1-(((self.timer.getloops()+1-self.timer.getratio())/len(self.sprites)))**3,0)
|
self.alpha = max(1-(((self.timer.getloops()+1-self.timer.getratio())/len(self.sprites)))**3,0)
|
||||||
|
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self):
|
||||||
|
|
||||||
|
game = self.game
|
||||||
|
|
||||||
spriteindex = self.timer.getloops()
|
spriteindex = self.timer.getloops()
|
||||||
posx,posy = self.rect[:2]
|
posx,posy = self.rect[:2]
|
||||||
|
@ -4,13 +4,13 @@ class BGMSlider(Slider):
|
|||||||
def __init__(self,x,y,game,w=100,h=64,folder="base"):
|
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
|
super().__init__(x,y,game,w,h,folder) # initialise l'objet de base avec les bons arguments
|
||||||
|
|
||||||
self.currentvalue = self.getvalue(game)
|
self.currentvalue = self.getvalue()
|
||||||
|
|
||||||
self.posttext = " % Musique"
|
self.posttext = " % Musique"
|
||||||
|
|
||||||
def change(self,game):
|
def change(self):
|
||||||
game.globals["bgmvolume"] = self.currentvalue/100
|
self.game.globals["bgmvolume"] = self.currentvalue/100
|
||||||
game.reinit_volumes()
|
self.game.reinit_volumes()
|
||||||
|
|
||||||
def getvalue(self,game):
|
def getvalue(self):
|
||||||
return game.globals["bgmvolume"]*100
|
return self.game.globals["bgmvolume"]*100
|
||||||
|
@ -4,13 +4,13 @@ class SFXSlider(Slider):
|
|||||||
def __init__(self,x,y,game,w=100,h=64,folder="base"):
|
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
|
super().__init__(x,y,game,w,h,folder) # initialise l'objet de base avec les bons arguments
|
||||||
|
|
||||||
self.currentvalue = self.getvalue(game)
|
self.currentvalue = self.getvalue()
|
||||||
|
|
||||||
self.posttext = " % Effets Sonores"
|
self.posttext = " % Effets Sonores"
|
||||||
|
|
||||||
def change(self,game):
|
def change(self):
|
||||||
game.globals["sfxvolume"] = self.currentvalue/100
|
self.game.globals["sfxvolume"] = self.currentvalue/100
|
||||||
game.reinit_volumes()
|
self.game.reinit_volumes()
|
||||||
|
|
||||||
def getvalue(self,game):
|
def getvalue(self):
|
||||||
return game.globals["sfxvolume"]*100
|
return self.game.globals["sfxvolume"]*100
|
||||||
|
@ -8,30 +8,30 @@ class Slider(base.BaseObject):
|
|||||||
|
|
||||||
self.max = 100
|
self.max = 100
|
||||||
|
|
||||||
self.currentvalue = self.getvalue(game)
|
self.currentvalue = self.getvalue()
|
||||||
|
|
||||||
self.bgsprite = self.gensprite(game,w,h,folder)
|
self.bgsprite = self.gensprite(w,h,folder)
|
||||||
|
|
||||||
self.sprite = game.pygame.transform.scale(game.sprite_lib["gui/slider/"+folder+"/circle.png"],(h,h))
|
self.sprite = game.pygame.transform.scale(game.sprite_lib["gui/slider/"+folder+"/circle.png"],(h,h))
|
||||||
|
|
||||||
self.maxwidth = w-h
|
self.maxwidth = w-h
|
||||||
self.rect = [self.getvalue(game)/self.max*(self.maxwidth)+self.baserect[0],self.baserect[1],h,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.sfx = game.sound_lib["sfx/click.wav"]
|
||||||
|
|
||||||
self.dragged = False
|
self.dragged = False
|
||||||
|
|
||||||
def change(self,game):
|
def change(self):
|
||||||
print("Value : "+self.currentvalue)
|
print("Value : "+self.currentvalue)
|
||||||
|
|
||||||
def getvalue(self,game):
|
def getvalue(self):
|
||||||
return game.globals["sfxvolume"]*100
|
return self.game.globals["sfxvolume"]*100
|
||||||
|
|
||||||
def postovalue(self):
|
def postovalue(self):
|
||||||
self.currentvalue = (self.rect[0]-self.baserect[0])/(self.maxwidth)*self.max
|
self.currentvalue = (self.rect[0]-self.baserect[0])/(self.maxwidth)*self.max
|
||||||
|
|
||||||
def gensprite(self,game,w,h,folder):
|
def gensprite(self,w,h,folder):
|
||||||
|
game = self.game
|
||||||
left = game.sprite_lib["gui/slider/"+folder+"/left.png"]
|
left = game.sprite_lib["gui/slider/"+folder+"/left.png"]
|
||||||
left = game.pygame.transform.scale(left,(round(h/left.get_height()*left.get_width()),h))
|
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.sprite_lib["gui/slider/"+folder+"/right.png"]
|
||||||
@ -48,7 +48,8 @@ class Slider(base.BaseObject):
|
|||||||
return surface
|
return surface
|
||||||
|
|
||||||
|
|
||||||
def step(self,game):
|
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[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 self.rect[1]<=game.inputs["mouse"]["pos"][1]+game.globals["cameray"]<=self.rect[1]+self.rect[3]:
|
||||||
if game.inputs["mouse"]["click"]>1:
|
if game.inputs["mouse"]["click"]>1:
|
||||||
@ -61,10 +62,12 @@ class Slider(base.BaseObject):
|
|||||||
|
|
||||||
if self.dragged and game.inputs["mouse"]["click"]==0:
|
if self.dragged and game.inputs["mouse"]["click"]==0:
|
||||||
# Le slider a été laché
|
# Le slider a été laché
|
||||||
self.change(game)
|
self.change()
|
||||||
self.dragged = False
|
self.dragged = False
|
||||||
|
|
||||||
def draw(self,game):
|
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.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"]))
|
game.window.blit(self.sprite,(self.rect[0]-game.globals["camerax"],self.rect[1]-game.globals["cameray"]))
|
||||||
|
@ -4,6 +4,8 @@ from gamedata.objects.bg.menubackground import MenuBackground
|
|||||||
from gamedata.objects.menu.optionmenu import OptionMenu
|
from gamedata.objects.menu.optionmenu import OptionMenu
|
||||||
from gamedata.objects.sliders.bgmslider import BGMSlider
|
from gamedata.objects.sliders.bgmslider import BGMSlider
|
||||||
from gamedata.objects.sliders.sfxslider import SFXSlider
|
from gamedata.objects.sliders.sfxslider import SFXSlider
|
||||||
|
from gamedata.objects.combat.player import Player
|
||||||
|
from gamedata.objects.combat.tileset import TilesetRenderer
|
||||||
|
|
||||||
def main(game):
|
def main(game):
|
||||||
game.gameloop.reinit() # Je réinitialis la boucle
|
game.gameloop.reinit() # Je réinitialis la boucle
|
||||||
@ -12,6 +14,13 @@ def main(game):
|
|||||||
game.gameloop.summon(bg)
|
game.gameloop.summon(bg)
|
||||||
game.gameloop.summon(menu)
|
game.gameloop.summon(menu)
|
||||||
|
|
||||||
|
def fight(game):
|
||||||
|
game.gameloop.reinit()
|
||||||
|
p1 = Player(50,50,game)
|
||||||
|
tileset = TilesetRenderer(0,0,game)
|
||||||
|
game.gameloop.summon(p1)
|
||||||
|
game.gameloop.summon(tileset)
|
||||||
|
|
||||||
def options(game):
|
def options(game):
|
||||||
game.gameloop.reinit()
|
game.gameloop.reinit()
|
||||||
game.globals["camerax"] = 0
|
game.globals["camerax"] = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user