added more animations for the boats, preview boat are now handled with a whole texture instead of a color filter

This commit is contained in:
Faraphel 2023-03-08 21:14:45 +01:00
parent 1c872f7a28
commit ff14a4e5d4
76 changed files with 17 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 927 KiB

After

Width:  |  Height:  |  Size: 812 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

View file

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View file

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 572 B

View file

Before

Width:  |  Height:  |  Size: 609 B

After

Width:  |  Height:  |  Size: 609 B

View file

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 644 B

View file

Before

Width:  |  Height:  |  Size: 695 B

After

Width:  |  Height:  |  Size: 695 B

View file

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 712 B

View file

Before

Width:  |  Height:  |  Size: 753 B

After

Width:  |  Height:  |  Size: 753 B

View file

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

View file

Before

Width:  |  Height:  |  Size: 708 B

After

Width:  |  Height:  |  Size: 708 B

View file

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

View file

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 533 B

View file

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

View file

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

View file

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 339 B

View file

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View file

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View file

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 231 B

View file

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 281 B

View file

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 321 B

View file

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

View file

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 445 B

View file

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 467 B

View file

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -12,14 +12,18 @@ class Grid:
class Boat: class Boat:
class Style1(Style): class Style1(Style):
_animation = sorted( _anim_bomb = sorted((path_boat / "anim_bomb").iterdir(), key=lambda path: int(path.stem))
(path_boat / "animation").iterdir(), _anim_body = sorted((path_boat / "anim_body").iterdir(), key=lambda path: int(path.stem))
key=lambda path: int(path.stem) _anim_edge = sorted((path_boat / "anim_edge").iterdir(), key=lambda path: int(path.stem))
) _anim_solo = sorted((path_boat / "anim_solo").iterdir(), key=lambda path: int(path.stem))
body = Texture(path_boat / "body.png") body = Animation([*_anim_body, path_boat / "body.png"], 0.03, False)
edge = Texture(path_boat / "edge.png") edge = Animation([*_anim_edge, path_boat / "edge.png"], 0.03, False)
solo = Texture(path_boat / "solo.png") solo = Animation([*_anim_solo, path_boat / "solo.png"], 0.03, False)
missed = Animation([*_animation, path_boat / "missed.png"], 0.03, False) preview_body = Texture(path_boat / "preview_body.png")
touched = Animation([*_animation, path_boat / "touched.png"], 0.03, False) preview_edge = Texture(path_boat / "preview_edge.png")
preview_solo = Texture(path_boat / "preview_solo.png")
missed = Animation([*_anim_bomb, path_boat / "missed.png"], 0.03, False)
touched = Animation([*_anim_bomb, path_boat / "touched.png"], 0.03, False)

View file

@ -1,11 +0,0 @@
from .abc import Style
from .type import Texture
from source.path import path_image
path = path_image / "replay"
class Replay:
class Style1(Style):
previous = Texture(path / "previous.png")
next = Texture(path / "next.png")

View file

@ -10,7 +10,7 @@ from source.core.error import InvalidBoatPosition
from source.gui.better_pyglet import Sprite from source.gui.better_pyglet import Sprite
from source.gui.texture.abc import Style from source.gui.texture.abc import Style
from source.gui.widget.abc import BoxWidget from source.gui.widget.abc import BoxWidget
from source.type import Distance, ColorRGB, Point2D from source.type import Distance, Point2D
from source.utils import dict_filter_prefix from source.utils import dict_filter_prefix
if TYPE_CHECKING: if TYPE_CHECKING:
@ -32,7 +32,6 @@ class GameGrid(BoxWidget):
width: Distance = None, width: Distance = None,
height: Distance = None, height: Distance = None,
preview_color: ColorRGB = (150, 255, 150),
boats_length: list[int] = None, boats_length: list[int] = None,
rows: int = None, rows: int = None,
@ -52,7 +51,6 @@ class GameGrid(BoxWidget):
# the list of the size of the boats to place # the list of the size of the boats to place
self.boats_length = [] if boats_length is None else sorted(boats_length, reverse=True) self.boats_length = [] if boats_length is None else sorted(boats_length, reverse=True)
self.preview_color = preview_color
# créer la planche du jeu # créer la planche du jeu
self.board = Board(width=rows, height=columns) if board_data is None else Board.from_json(board_data) self.board = Board(width=rows, height=columns) if board_data is None else Board.from_json(board_data)
@ -200,9 +198,10 @@ class GameGrid(BoxWidget):
) )
# si le bateau est le dernier placé et qu'on est en prévisualisation, change sa teinte. # si le bateau est le dernier placé et qu'on est en prévisualisation, change sa teinte.
color: ColorRGB = self.preview_color if preview and value == max_boat else (255, 255, 255) if preview and value == max_boat:
form: str = f"preview_{form}"
hash_new = hash((form, rotation, color)) hash_new = hash((form, rotation))
sprite_old, hash_old = self.cell_sprites.get((x, y), (None, None)) sprite_old, hash_old = self.cell_sprites.get((x, y), (None, None))
if hash_old == hash_new: if hash_old == hash_new:
@ -215,7 +214,6 @@ class GameGrid(BoxWidget):
**self._boat_kwargs **self._boat_kwargs
) )
sprite.rotation = rotation * 90 sprite.rotation = rotation * 90
sprite.color = color
self.cell_sprites[x, y] = (sprite, hash_new) self.cell_sprites[x, y] = (sprite, hash_new)