Ver código fonte

gameV1

master
valdoucet 3 anos atrás
pai
commit
5c8e8b62c3
11 arquivos alterados com 62 adições e 0 exclusões
  1. +0
    -0
      game/.gitignore
  2. +0
    -0
      game/LICENSE
  3. +0
    -0
      game/README.md
  4. +62
    -0
      game/code.py
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     

.gitignore → game/.gitignore Ver arquivo


LICENSE → game/LICENSE Ver arquivo


README.md → game/README.md Ver arquivo


+ 62
- 0
game/code.py Ver arquivo

@@ -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()








Carregando…
Cancelar
Salvar