Jämför commits

...

2 Incheckningar

Upphovsman SHA1 Meddelande Datum
  valdoucet 647e5116b3 Game(dash) 3 år sedan
  valdoucet 5c8e8b62c3 gameV1 3 år sedan
11 ändrade filer med 64 tillägg och 0 borttagningar
Delad Vy
  1. +0
    -0
      game/.gitignore
  2. +0
    -0
      game/LICENSE
  3. +0
    -0
      game/README.md
  4. +64
    -0
      game/code.py
  5. Binär
     
  6. Binär
     
  7. Binär
     
  8. Binär
     
  9. Binär
     
  10. Binär
     
  11. Binär
     

.gitignore → game/.gitignore Visa fil


LICENSE → game/LICENSE Visa fil


README.md → game/README.md Visa fil


+ 64
- 0
game/code.py Visa fil

@@ -0,0 +1,64 @@
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
saut = -7
gravite = 0.2
frotement = 1
gamemod_speed = -3
dash = 0
espassement = 1

def draw():
screen.blit("back", (0, 0))
didi.draw()
th.draw()
tb.draw()

def update():
global end, saut, gamemod_speed, dash
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 += 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:
saut += -5
elif button == mouse.RIGHT:
dash += -1

pgzrun.go()

Binär
Visa fil


Binär
Visa fil


Binär
Visa fil


Binär
Visa fil


Binär
Visa fil


Binär
Visa fil


Binär
Visa fil


Laddar…
Avbryt
Spara