diff --git a/.gitignore b/game/.gitignore similarity index 100% rename from .gitignore rename to game/.gitignore diff --git a/LICENSE b/game/LICENSE similarity index 100% rename from LICENSE rename to game/LICENSE diff --git a/README.md b/game/README.md similarity index 100% rename from README.md rename to game/README.md diff --git a/game/code.py b/game/code.py new file mode 100644 index 0000000..6086460 --- /dev/null +++ b/game/code.py @@ -0,0 +1,62 @@ +import pgzrun +import random + +TITLE = "didi bird" +WIDTH = 490 +HEIGHT = 490 +tb = Actor("bottom", midtop=(490, 350)) +th = Actor("top", midbottom=(490, 125)) +didi = Actor("bird1", (245, 245)) +end = 0 +gravitée = 2 +saut = -35 +gamemod_speed = -3 +flash = -30 +espassement = 1 + +def draw(): + screen.blit("back", (0, 0)) + didi.draw() + th.draw() + tb.draw() + +def update(): + global end + + if didi.y == 475 and end == 0: + print("--Game over--") + end = 1 + + if didi.y < 475 and end == 0: + th.x += gamemod_speed + tb.x += gamemod_speed + + if th.x <= 0: + tb.x = 490 + tb.y = random.randrange(520,600) + th.x = 490 + th.y = random.randrange(-160, -40) + + if didi.y <= 15: + didi.y == 15 + + if end == 0 and (didi.colliderect(tb) or didi.colliderect(th)): + print("--Game over--") + end = 1 + + if didi.y < 475 and end == 0 : + didi.y += gravitée + + + +def on_mouse_down(button): + if button == mouse.LEFT: + didi.y += saut + elif button == mouse.RIGHT: + th.x += flash + tb.x += flash + + + + +pgzrun.go() diff --git a/game/images/back.jpg b/game/images/back.jpg new file mode 100644 index 0000000..ebe95f9 Binary files /dev/null and b/game/images/back.jpg differ diff --git a/game/images/bird0.png b/game/images/bird0.png new file mode 100644 index 0000000..5600b4d Binary files /dev/null and b/game/images/bird0.png differ diff --git a/game/images/bird1.png b/game/images/bird1.png new file mode 100644 index 0000000..91b18d5 Binary files /dev/null and b/game/images/bird1.png differ diff --git a/game/images/bird2.png b/game/images/bird2.png new file mode 100644 index 0000000..9858fb4 Binary files /dev/null and b/game/images/bird2.png differ diff --git a/game/images/birddead.png b/game/images/birddead.png new file mode 100644 index 0000000..c9bb381 Binary files /dev/null and b/game/images/birddead.png differ diff --git a/game/images/bottom.png b/game/images/bottom.png new file mode 100644 index 0000000..5963339 Binary files /dev/null and b/game/images/bottom.png differ diff --git a/game/images/top.png b/game/images/top.png new file mode 100644 index 0000000..7e1fe71 Binary files /dev/null and b/game/images/top.png differ