Skip to content

Commit 86d5647

Browse files
authored
Merge pull request #5 from PythonBiellaGroup/feature/update-game02
Feature/update game02
2 parents 0a93678 + b296359 commit 86d5647

File tree

14 files changed

+195
-57
lines changed

14 files changed

+195
-57
lines changed

game02/1_punteggio.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
game_over = False
99

1010
ape = Actor("ape")
11-
ape.pos = 100,100
11+
ape.pos = 100, 100
1212

1313
fiore = Actor("fiore")
14-
fiore.pos = 200,200
14+
fiore.pos = 200, 200
15+
1516

1617
def draw():
17-
screen.blit("sfondo", (0,0))
18+
screen.blit("sfondo", (0, 0))
1819
fiore.draw()
1920
ape.draw()
20-
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10,10))
21+
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10, 10))
2122

2223

23-
pgzrun.go()
24+
pgzrun.go()

game02/2_1_pass.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,44 @@
88
game_over = False
99

1010
ape = Actor("ape")
11-
ape.pos = 100,100
11+
ape.pos = 100, 100
1212

1313
fiore = Actor("fiore")
14-
fiore.pos = 200,200
14+
fiore.pos = 200, 200
15+
1516

1617
def draw():
17-
'''
18+
"""
1819
Funzione speciale PGZ
19-
'''
20-
screen.blit("sfondo", (0,0))
20+
"""
21+
screen.blit("sfondo", (0, 0))
2122
fiore.draw()
2223
ape.draw()
23-
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10,10))
24+
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10, 10))
2425

2526
if game_over:
26-
screen.fill("pink")
27-
screen.draw.text("Tempo scaduto! Punteggio finale: " + str(punteggio), midtop=(WIDTH/2,10),
28-
fontsize=40, color="red")
27+
screen.fill("pink")
28+
screen.draw.text(
29+
"Tempo scaduto! Punteggio finale: " + str(punteggio),
30+
midtop=(WIDTH / 2, 10),
31+
fontsize=40,
32+
color="red",
33+
)
2934

3035

3136
def piazza_fiore():
3237
pass
3338

39+
3440
def tempo_scaduto():
3541
pass
3642

43+
3744
def update():
38-
'''
45+
"""
3946
Funzione speciale PGZ
40-
'''
47+
"""
4148
pass
4249

43-
pgzrun.go()
4450

51+
pgzrun.go()

game02/2_2_timer.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,42 @@
88
game_over = False
99

1010
ape = Actor("ape")
11-
ape.pos = 100,100
11+
ape.pos = 100, 100
1212

1313
fiore = Actor("fiore")
14-
fiore.pos = 200,200
14+
fiore.pos = 200, 200
15+
1516

1617
def draw():
17-
screen.blit("sfondo", (0,0))
18+
screen.blit("sfondo", (0, 0))
1819
fiore.draw()
1920
ape.draw()
20-
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10,10))
21+
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10, 10))
2122

2223
if game_over:
23-
screen.fill("pink")
24-
screen.draw.text("Tempo scaduto! Punteggio finale: " + str(punteggio), midtop=(WIDTH/2,10),
25-
fontsize=40, color="red")
24+
screen.fill("pink")
25+
screen.draw.text(
26+
"Tempo scaduto! Punteggio finale: " + str(punteggio),
27+
midtop=(WIDTH / 2, 10),
28+
fontsize=40,
29+
color="red",
30+
)
31+
2632

2733
def piazza_fiore():
28-
fiore.x = randint(70, (WIDTH-70))
29-
fiore.y = randint(70, (HEIGHT-70))
34+
fiore.x = randint(70, (WIDTH - 70))
35+
fiore.y = randint(70, (HEIGHT - 70))
36+
3037

3138
def tempo_scaduto():
32-
global game_over
39+
global game_over
3340
game_over = True
3441

42+
3543
def update():
36-
'''
44+
"""
3745
Funzione speciale PGZ
38-
'''
46+
"""
3947
pass
4048

4149

game02/3_1_mov_actor.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,42 @@
88
game_over = False
99

1010
ape = Actor("ape")
11-
ape.pos = 100,100
11+
ape.pos = 100, 100
1212

1313
fiore = Actor("fiore")
14-
fiore.pos = 200,200
14+
fiore.pos = 200, 200
15+
1516

1617
def draw():
17-
screen.blit("sfondo", (0,0))
18+
screen.blit("sfondo", (0, 0))
1819
fiore.draw()
1920
ape.draw()
20-
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10,10))
21+
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10, 10))
2122

2223
if game_over:
23-
screen.fill("pink")
24-
screen.draw.text("Tempo scaduto! Punteggio finale: " + str(punteggio), midtop=(WIDTH/2,10),
25-
fontsize=40, color="red")
24+
screen.fill("pink")
25+
screen.draw.text(
26+
"Tempo scaduto! Punteggio finale: " + str(punteggio),
27+
midtop=(WIDTH / 2, 10),
28+
fontsize=40,
29+
color="red",
30+
)
31+
2632

2733
def piazza_fiore():
28-
fiore.x = randint(70, (WIDTH-70))
29-
fiore.y = randint(70, (HEIGHT-70))
34+
fiore.x = randint(70, (WIDTH - 70))
35+
fiore.y = randint(70, (HEIGHT - 70))
36+
3037

3138
def tempo_scaduto():
32-
global game_over
39+
global game_over
3340
game_over = True
3441

42+
3543
def update():
36-
'''
44+
"""
3745
Funzione speciale PGZ
38-
'''
46+
"""
3947
if keyboard.left:
4048
ape.x = ape.x - 2
4149
if keyboard.right:
@@ -47,4 +55,4 @@ def update():
4755

4856

4957
clock.schedule(tempo_scaduto, 10.0)
50-
pgzrun.go()
58+
pgzrun.go()

game02/3_2_collisione.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,42 @@
88
game_over = False
99

1010
ape = Actor("ape")
11-
ape.pos = 100,100
11+
ape.pos = 100, 100
1212

1313
fiore = Actor("fiore")
14-
fiore.pos = 200,200
14+
fiore.pos = 200, 200
15+
1516

1617
def draw():
17-
screen.blit("sfondo", (0,0))
18+
screen.blit("sfondo", (0, 0))
1819
fiore.draw()
1920
ape.draw()
20-
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10,10))
21+
screen.draw.text("Punteggio: " + str(punteggio), color="black", topleft=(10, 10))
2122

2223
if game_over:
23-
screen.fill("pink")
24-
screen.draw.text("Tempo scaduto! Punteggio finale: " + str(punteggio), midtop=(WIDTH/2,10),
25-
fontsize=40, color="red")
24+
screen.fill("pink")
25+
screen.draw.text(
26+
"Tempo scaduto! Punteggio finale: " + str(punteggio),
27+
midtop=(WIDTH / 2, 10),
28+
fontsize=40,
29+
color="red",
30+
)
31+
2632

2733
def piazza_fiore():
28-
fiore.x = randint(70, (WIDTH-70))
29-
fiore.y = randint(70, (HEIGHT-70))
34+
fiore.x = randint(70, (WIDTH - 70))
35+
fiore.y = randint(70, (HEIGHT - 70))
36+
3037

3138
def tempo_scaduto():
32-
global game_over
39+
global game_over
3340
game_over = True
3441

42+
3543
def update():
36-
'''
44+
"""
3745
Funzione speciale PGZ
38-
'''
46+
"""
3947
global punteggio
4048

4149
if keyboard.left:
@@ -55,4 +63,4 @@ def update():
5563

5664

5765
clock.schedule(tempo_scaduto, 10.0)
58-
pgzrun.go()
66+
pgzrun.go()

game02/ape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ def update():
5656

5757
piazza_fiore()
5858
clock.schedule(tempo_scaduto, 10.0)
59-
pgzrun.go()
59+
pgzrun.go()

game02_1/images/nota musicale.png

3.2 KB
Loading

game02_1/images/sfondo.png

93.5 KB
Loading

game02_1/images/tony.png

6.22 KB
Loading

game02_1/images/tony2.png

6.83 KB
Loading

0 commit comments

Comments
 (0)