From 647e5116b3ce07c1e7c0587f7971b9eb5f5f5394 Mon Sep 17 00:00:00 2001 From: valdoucet Date: Mon, 4 Jan 2021 20:55:22 +0100 Subject: [PATCH] Game(dash) --- game/code.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/game/code.py b/game/code.py index 6086460..ec106f9 100644 --- a/game/code.py +++ b/game/code.py @@ -8,10 +8,11 @@ tb = Actor("bottom", midtop=(490, 350)) th = Actor("top", midbottom=(490, 125)) didi = Actor("bird1", (245, 245)) end = 0 -gravitée = 2 -saut = -35 +saut = -7 +gravite = 0.2 +frotement = 1 gamemod_speed = -3 -flash = -30 +dash = 0 espassement = 1 def draw(): @@ -21,7 +22,7 @@ def draw(): tb.draw() def update(): - global end + global end, saut, gamemod_speed, dash if didi.y == 475 and end == 0: print("--Game over--") @@ -32,9 +33,9 @@ def update(): tb.x += gamemod_speed if th.x <= 0: - tb.x = 490 + tb.x = 490 tb.y = random.randrange(520,600) - th.x = 490 + th.x = 490 th.y = random.randrange(-160, -40) if didi.y <= 15: @@ -45,18 +46,19 @@ def update(): end = 1 if didi.y < 475 and end == 0 : - didi.y += gravitée + didi.y += saut + saut += gravite + gamemod_speed += dash - + if dash < 0 and end == 0: + dash += frotement def on_mouse_down(button): + global saut, dash if button == mouse.LEFT: - didi.y += saut + saut += -5 elif button == mouse.RIGHT: - th.x += flash - tb.x += flash + dash += -1 - - pgzrun.go()