@@ -6,29 +6,39 @@ HEIGHT = 700 | |||||
titi = Actor('bird1', (75, 350)) | titi = Actor('bird1', (75, 350)) | ||||
tutu = Actor ('bird2', ( 300, 20)) | tutu = Actor ('bird2', ( 300, 20)) | ||||
top = Actor('top', (300, -150)) | |||||
bottom = Actor ('bottom', (300, 800)) | |||||
top_tube = Actor('top', (300, 0)) | |||||
bottom_tube = Actor ('bottom', (300, 800)) | |||||
fond = Actor('background', (200,350)) | |||||
fond2 = Actor('background', (-200,350)) | |||||
def draw(): | def draw(): | ||||
screen.blit('background', (0, 0)) | |||||
fond.draw() | |||||
fond2.draw() | |||||
titi.draw() | titi.draw() | ||||
tutu.draw() | tutu.draw() | ||||
top.draw() | |||||
bottom.draw() | |||||
top_tube.draw() | |||||
bottom_tube.draw() | |||||
def on_mouse_down(pos): | def on_mouse_down(pos): | ||||
print( pos, 'est la position lors du clic gauche') | |||||
print( pos, 'est la position de titi lors du clic gauche') | |||||
titi.backupspeed = titi.speed | titi.backupspeed = titi.speed | ||||
tutu.backupspeed = tutu.speed | tutu.backupspeed = tutu.speed | ||||
titi.speed = 0 | titi.speed = 0 | ||||
tutu.speed = 0 | tutu.speed = 0 | ||||
def on_mouse_up (pos): | |||||
print( pos) | |||||
def on_mouse_up (): | |||||
titi.speed = titi.backupspeed + 2 | titi.speed = titi.backupspeed + 2 | ||||
tutu.speed = tutu.backupspeed + 2 | tutu.speed = tutu.backupspeed + 2 | ||||
def update(): | def update(): | ||||
fond.x += 2 | |||||
fond2.x +=2 | |||||
if fond.x > 400 : | |||||
fond.x = 200 | |||||
if fond2.x > 200 : | |||||
fond2.x = 0 | |||||
titi.x += titi.speed | titi.x += titi.speed | ||||
tutu.y += tutu.speed | tutu.y += tutu.speed | ||||
if titi.x > 400 : | if titi.x > 400 : | ||||
@@ -36,7 +46,6 @@ def update(): | |||||
if tutu.y > 700 : | if tutu.y > 700 : | ||||
tutu.y = 10 | tutu.y = 10 | ||||
titi.speed = 1 | titi.speed = 1 | ||||
tutu.speed = 1 | tutu.speed = 1 | ||||
@@ -0,0 +1,34 @@ | |||||
import pgzrun | |||||
TITLE = "Paf l'oiseau" | |||||
WIDTH = 400 | |||||
HEIGHT = 708 | |||||
def on_mouse_down(): | |||||
print('Clic souris !') | |||||
titi.y -= 50 | |||||
def update(): | |||||
titi.y += titi.speed | |||||
tube_superieur.x -= vitesse_defilement | |||||
tube_inferieur.x -= vitesse_defilement | |||||
if tube_superieur.x + tube_superieur.width/2< 0 : | |||||
tube_superieur.x = WIDTH + tube_superieur.width/2 | |||||
tube_inferieur.x = WIDTH + tube_superieur.width/2 | |||||
def draw(): | |||||
screen.blit('background', (0, 0)) | |||||
titi.draw() | |||||
tube_superieur.draw() | |||||
tube_inferieur.draw() | |||||
titi = Actor('bird1', (75, 350)) | |||||
titi.speed = 1 | |||||
ecart = 140 | |||||
tube_superieur = Actor('top', (300, 0)) | |||||
tube_inferieur = Actor('bottom', (300, tube_superieur.height + ecart)) | |||||
vitesse_defilement = 1 | |||||
# print(tube_superieur.width, tube_superieur.height) | |||||
pgzrun.go() |
@@ -0,0 +1,44 @@ | |||||
import pgzrun | |||||
TITLE = "Paf l'oiseau" | |||||
WIDTH = 400 | |||||
HEIGHT = 708 | |||||
fond = Actor('background', (200,350)) | |||||
fond2 = Actor('background', (-200,350)) | |||||
def on_mouse_down(): | |||||
print('Clic souris !') | |||||
titi.y -= 50 | |||||
def update(): | |||||
fond.x += 2 | |||||
fond2.x +=2 | |||||
if fond.x > 400 : | |||||
fond.x = 200 | |||||
if fond2.x > 200 : | |||||
fond2.x = 0 | |||||
titi.y += titi.speed | |||||
tube_superieur.x -= vitesse_defilement | |||||
tube_inferieur.x -= vitesse_defilement | |||||
if tube_superieur.x + tube_superieur.width/2< 0 : | |||||
tube_superieur.x = WIDTH + tube_superieur.width/2 | |||||
tube_inferieur.x = WIDTH + tube_superieur.width/2 | |||||
def draw(): | |||||
fond.draw() | |||||
fond2.draw() | |||||
titi.draw() | |||||
tube_superieur.draw() | |||||
tube_inferieur.draw() | |||||
titi = Actor('bird1', (75, 350)) | |||||
titi.speed = 1 | |||||
ecart = 140 | |||||
tube_superieur = Actor('top', (300, 0)) | |||||
tube_inferieur = Actor('bottom', (300, tube_superieur.height + ecart)) | |||||
vitesse_defilement = 1 | |||||
# print(tube_superieur.width, tube_superieur.height) | |||||
pgzrun.go() |