Przeglądaj źródła

Après la résolution des challenges

chap1-challenge-2directions
Alain Somville 3 lat temu
rodzic
commit
c6e040fa2c
3 zmienionych plików z 43 dodań i 1 usunięć
  1. +43
    -1
      birdie.py
  2. BIN
     
  3. +0
    -0
     

+ 43
- 1
birdie.py Wyświetl plik

@@ -1 +1,43 @@
print('Hello world !')
import pgzrun

TITLE = "Paf l'oiseau"
WIDTH = 918
HEIGHT = 1024


titi = Actor('bird1',(100,200))
piaf = Actor('bird1',(150,250))

titi.speed = 1
piaf.speed = 2

def draw():
screen.blit('rory',(0,0))
titi.draw()
piaf.draw()

def update():
titi.y+=titi.speed
piaf.x+=piaf.speed
if titi.top >= HEIGHT:
titi.bottom = 0
if piaf.left >= WIDTH:
piaf.right = 0

def on_mouse_down(button):
if button == mouse.LEFT:
print('Accélération!')
titi.speed+=1
piaf.speed+=2
elif button == mouse.RIGHT:
print('Freinage!')
titi.speed-=2
piaf.speed-=4

def on_mouse_up():
print('clicsouris!')
titi.speed = 1
piaf.speed = 2

pgzrun.go()


+ 0
- 0
Wyświetl plik


Ładowanie…
Anuluj
Zapisz