Updated sliders

This commit is contained in:
theo@manjaro 2021-09-17 07:43:53 +02:00
parent 8b69c76b2e
commit 86c9a5fd0d
2 changed files with 7 additions and 9 deletions

View File

@ -53,7 +53,6 @@ class Manager(BaseObject):
# Game over
if self.endtimer.tick(self.game.dt):
self.game.globals["score"] = self.score
print(self.game.globals["score"])
self.game.scenes.gameover(self.game)
if self.invincible:

View File

@ -50,15 +50,14 @@ class Slider(base.BaseObject):
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
if self.baserect.collidepoint(game.inputs["mouse"]["pos"]):
if game.inputs["mouse"]["click"]>1:
self.rect[0] = game.inputs["mouse"]["pos"][0]-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()
self.postovalue()
if self.dragged and game.inputs["mouse"]["click"]==0:
# Le slider a été laché