game: add: vector colision (Not work)

This commit is contained in:
2024-02-01 13:18:11 +01:00
parent ab325ae489
commit d332ef8103
12 changed files with 260 additions and 153 deletions

View File

@ -1,12 +1,20 @@
from .Point import Point
import math
class Segment:
def __init__(self, start: Point, stop: Point) -> None:
self.start: Point = start
self.stop: Point = stop
self.length: float = math.dist((self.start.x, self.start.y), (self.stop.x, self.stop.y))
def __repr__(self) -> str:
return f"Segment(start: {self.start}, stop: {self.stop})"
def __str__(self) -> str:
return f"Segment(start: {self.start}, stop: {self.stop})"
def to_dict(self):
data: dict[str: dict] = {