feat: initial implementation of image capture

This commit is contained in:
2025-10-25 17:20:17 +02:00
parent 8d35f76b56
commit d46aa6af45
5 changed files with 27 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
from __future__ import annotations
from math import radians
from typing import Optional
from typing import TYPE_CHECKING, Optional
import pygame
@@ -8,6 +10,9 @@ from src.remote_controller import RemoteController
from src.utils import get_segments_intersection, segments_intersect
from src.vec import Vec
if TYPE_CHECKING:
from src.game import Game
def sign(x): return 0 if x == 0 else (-1 if x < 0 else 1)
@@ -27,7 +32,8 @@ class Car:
RAYS_FOV = 180
RAYS_MAX_DIST = 100
def __init__(self, pos: Vec, direction: Vec) -> None:
def __init__(self, game: Game, pos: Vec, direction: Vec) -> None:
self.game: Game = game
self.initial_pos: Vec = pos.copy()
self.initial_dir: Vec = direction.copy()
self.pos: Vec = pos
@@ -42,7 +48,7 @@ class Car:
self.rays: list[float] = [0] * self.N_RAYS
self.rays_end: list[Vec] = [Vec() for _ in range(self.N_RAYS)]
self.controller: RemoteController = RemoteController(self)
self.controller: RemoteController = RemoteController(self.game, self)
self.controller.start_server()
def update(self, dt: float):