Browse Source

Après la résolution des challenges

chap1-challenge-2directions
Alain Somville 3 years ago
parent
commit
c6e040fa2c
3 changed files with 43 additions and 1 deletions
  1. +43
    -1
      birdie.py
  2. BIN
     
  3. +0
    -0
     

+ 43
- 1
birdie.py View File

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

BIN
View File


+ 0
- 0
View File


Loading…
Cancel
Save