Bläddra i källkod

ok

chapitre-2-start
Alain Somville 3 år sedan
förälder
incheckning
e87b0fcdd0
1 ändrade filer med 18 tillägg och 2 borttagningar
  1. +18
    -2
      birdie.py

+ 18
- 2
birdie.py Visa fil

@@ -4,18 +4,34 @@ TITLE = "Paf l'oiseau"
WIDTH = 400 WIDTH = 400
HEIGHT = 708 HEIGHT = 708



titi = Actor('bird1', (75, 350))
titi.speed = 1
ecart = 50
tube_superieur = Actor ('top', (300,0))
tube_inferieur = Actor ('bottom',(300,tube_superieur.height + ecart))

def on_mouse_down(): def on_mouse_down():
print('Clic souris !') print('Clic souris !')
titi.y -= 50 titi.y -= 50


def update(): def update():
titi.y += titi.speed titi.y += titi.speed
tube_superieur.x -= vitesse_defilement
tube_inferieur.x -= vitesse_defilement*2
if tube_superieur.right < 0:
tube_superieur.left = WIDTH
if tube_inferieur.right < 0:
tube_inferieur.left = WIDTH


def draw(): def draw():
screen.blit('background', (0, 0)) screen.blit('background', (0, 0))
titi.draw() titi.draw()
tube_superieur.draw()
tube_inferieur.draw()


titi = Actor('bird1', (75, 350))
titi.speed = 1
print(tube_superieur.width, tube_inferieur.height)

vitesse_defilement = 1


pgzrun.go() pgzrun.go()

Laddar…
Avbryt
Spara