|
|
@@ -5,19 +5,39 @@ WIDTH = 400 |
|
|
|
HEIGHT = 708 |
|
|
|
|
|
|
|
titi = Actor('bird1', (151, 350)) |
|
|
|
titi2 = Actor('bird1', (11, 250)) |
|
|
|
|
|
|
|
def draw(): |
|
|
|
screen.blit('cascade', (0, 0)) |
|
|
|
titi.draw() |
|
|
|
titi2.draw() |
|
|
|
|
|
|
|
def on_mouse_down(): |
|
|
|
print('Clic souris !') |
|
|
|
titi.y -= 20 # équivalent à titi.y = titi.y - 50 |
|
|
|
titi.speed += 1 |
|
|
|
titi2.speed += 1 |
|
|
|
|
|
|
|
def on_mouse_up(): |
|
|
|
titi.speed += 1 |
|
|
|
titi2.speed += 2 |
|
|
|
|
|
|
|
def update(): |
|
|
|
titi.y += titi.speed |
|
|
|
|
|
|
|
if titi.x>400: |
|
|
|
titi.x = 0 |
|
|
|
titi.x += titi.speed |
|
|
|
else: |
|
|
|
titi.x += titi.speed |
|
|
|
|
|
|
|
if titi2.x>400: |
|
|
|
titi2.x = 0 |
|
|
|
titi2.x += titi2.speed |
|
|
|
|
|
|
|
else: |
|
|
|
titi2.x += titi.speed |
|
|
|
|
|
|
|
titi.speed = 1 |
|
|
|
titi2.speed = 1 |
|
|
|
|
|
|
|
|
|
|
|
pgzrun.go() |