added more animations for the boats, preview boat are now handled with a whole texture instead of a color filter
Before Width: | Height: | Size: 927 KiB After Width: | Height: | Size: 812 KiB |
BIN
assets/image/grid/boat/anim_body/1.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
assets/image/grid/boat/anim_body/10.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
assets/image/grid/boat/anim_body/11.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
assets/image/grid/boat/anim_body/12.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
assets/image/grid/boat/anim_body/13.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
assets/image/grid/boat/anim_body/14.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
assets/image/grid/boat/anim_body/2.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
assets/image/grid/boat/anim_body/3.png
Normal file
After Width: | Height: | Size: 180 B |
BIN
assets/image/grid/boat/anim_body/4.png
Normal file
After Width: | Height: | Size: 181 B |
BIN
assets/image/grid/boat/anim_body/5.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
assets/image/grid/boat/anim_body/6.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
assets/image/grid/boat/anim_body/7.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
assets/image/grid/boat/anim_body/8.png
Normal file
After Width: | Height: | Size: 181 B |
BIN
assets/image/grid/boat/anim_body/9.png
Normal file
After Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 156 B After Width: | Height: | Size: 156 B |
Before Width: | Height: | Size: 572 B After Width: | Height: | Size: 572 B |
Before Width: | Height: | Size: 609 B After Width: | Height: | Size: 609 B |
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 695 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 753 B After Width: | Height: | Size: 753 B |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 708 B |
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 691 B |
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 418 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 513 B |
BIN
assets/image/grid/boat/anim_edge/1.png
Normal file
After Width: | Height: | Size: 170 B |
BIN
assets/image/grid/boat/anim_edge/10.png
Normal file
After Width: | Height: | Size: 342 B |
BIN
assets/image/grid/boat/anim_edge/11.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
assets/image/grid/boat/anim_edge/12.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
assets/image/grid/boat/anim_edge/13.png
Normal file
After Width: | Height: | Size: 381 B |
BIN
assets/image/grid/boat/anim_edge/14.png
Normal file
After Width: | Height: | Size: 393 B |
BIN
assets/image/grid/boat/anim_edge/2.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
assets/image/grid/boat/anim_edge/3.png
Normal file
After Width: | Height: | Size: 228 B |
BIN
assets/image/grid/boat/anim_edge/4.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
assets/image/grid/boat/anim_edge/5.png
Normal file
After Width: | Height: | Size: 273 B |
BIN
assets/image/grid/boat/anim_edge/6.png
Normal file
After Width: | Height: | Size: 294 B |
BIN
assets/image/grid/boat/anim_edge/7.png
Normal file
After Width: | Height: | Size: 302 B |
BIN
assets/image/grid/boat/anim_edge/8.png
Normal file
After Width: | Height: | Size: 317 B |
BIN
assets/image/grid/boat/anim_edge/9.png
Normal file
After Width: | Height: | Size: 330 B |
BIN
assets/image/grid/boat/anim_solo/1.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
assets/image/grid/boat/anim_solo/10.png
Normal file
After Width: | Height: | Size: 654 B |
BIN
assets/image/grid/boat/anim_solo/11.png
Normal file
After Width: | Height: | Size: 746 B |
BIN
assets/image/grid/boat/anim_solo/12.png
Normal file
After Width: | Height: | Size: 735 B |
BIN
assets/image/grid/boat/anim_solo/13.png
Normal file
After Width: | Height: | Size: 742 B |
BIN
assets/image/grid/boat/anim_solo/14.png
Normal file
After Width: | Height: | Size: 820 B |
BIN
assets/image/grid/boat/anim_solo/2.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
assets/image/grid/boat/anim_solo/3.png
Normal file
After Width: | Height: | Size: 293 B |
BIN
assets/image/grid/boat/anim_solo/4.png
Normal file
After Width: | Height: | Size: 331 B |
BIN
assets/image/grid/boat/anim_solo/5.png
Normal file
After Width: | Height: | Size: 403 B |
BIN
assets/image/grid/boat/anim_solo/6.png
Normal file
After Width: | Height: | Size: 436 B |
BIN
assets/image/grid/boat/anim_solo/7.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
assets/image/grid/boat/anim_solo/8.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
assets/image/grid/boat/anim_solo/9.png
Normal file
After Width: | Height: | Size: 620 B |
Before Width: | Height: | Size: 747 B After Width: | Height: | Size: 404 B |
BIN
assets/image/grid/boat/preview_body.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
assets/image/grid/boat/preview_edge.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
assets/image/grid/boat/preview_solo.png
Normal file
After Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
|
@ -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)
|
||||||
|
|
|
@ -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")
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|