piege.py: ajout sprites

This commit is contained in:
neox 2023-12-26 09:48:37 +01:00
parent b22050a89f
commit 15e9ea202f
No known key found for this signature in database
GPG Key ID: 2974E1D5F25DFCC8
10 changed files with 25 additions and 11 deletions

36
piege.py Normal file → Executable file
View File

@ -41,20 +41,34 @@ def run_game():
ancrage='center')
modeles = {
"tirette_horiz":"",
"tirette_vert":"",
"tirette_horiz":"sprites/tirette.png",
"barre_horiz":"sprites/barre.png",
"tirette_vert":"sprites/tirette2.png",
"barre_horiz":"sprites/barre2.png",
"bille":"",
"cases"":""
"tour_de_plateau":"sprites/bois3.png",
"case1":"sprites/bois1.png",
"case2":"sprites/bois2.png"
}
while True:
fltk.mise_a_jour()
# Affichage plateau
for i in range(DIM):
for j in range(DIM):
for i in range(DIM+2):
for j in range(DIM+2):
# Choix du type de sprite selon position
if (i < 0 or j < 0 or i > DIM or j > DIM):
type_modele = "tour_de_plateau"
else:
if (i+j) % 2 == 0:
type_modele = "case1"
else:
type_modele = "case2"
fltk.image( 100+i*100,
150+j*100,
'media/{}.png'.format(modeles[type_modele]), #XXX déterminer type
modeles[type_modele], #XXX déterminer type
ancrage = "nw",
largeur=100,
hauteur=100,
@ -84,11 +98,11 @@ def run_game():
print("Clic sur coords ({},{})".format(x,y))
if x > 100 and y > 150 and x < 700 and y < 750:
x_n = int((x - 100) / 100)
y_n = int((y - 150) / 100)
print("Rotation de salle ({},{}) demandée".format(x_n, y_n))
réaliser_action()) #XXX
# if x > 100 and y > 150 and x < 700 and y < 750:
# x_n = int((x - 100) / 100)
# y_n = int((y - 150) / 100)
# print("Rotation de salle ({},{}) demandée".format(x_n, y_n))
# réaliser_action()) #XXX
## Fonction principale

BIN
sprites/barre.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
sprites/barre2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
sprites/bille.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
sprites/bille2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
sprites/bois.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
sprites/bois2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
sprites/bois3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
sprites/tirette.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
sprites/tirette2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB