ソースを参照

ajout reco clic droite ou gauche

chapitre-1-challenge-supp-correction-prof
コミット
4fc4f1c0d5
1個のファイルの変更12行の追加9行の削除
  1. +12
    -9
      birdie.py

+ 12
- 9
birdie.py ファイルの表示

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

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

def on_mouse_down(button):
if button == mouse.LEFT:
print('Freinage')
titi.vitesse -= 1
elif button == mouse.RIGHT :
print('Accelération')
titi.vitesse += 1
def update():
if titi.left > WIDTH:
titi.right = 0
if titi.right < 0:
titi.left = WIDTH
titi.x += titi.vitesse
titi2.x += titi2.vitesse

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

titi = Actor('bird1', (75, 350))
titi2 = Actor('bird0', (65,300))
titi.vitesse = 1
titi2.vitesse = 2

pgzrun.go()

読み込み中…
キャンセル
保存