feat: add connected indicator on car
This commit is contained in:
		| @@ -16,6 +16,7 @@ class Car: | ||||
|     MAX_BACK_SPEED = -3 | ||||
|     ROTATE_SPEED = 1 | ||||
|     COLOR = (230, 150, 80) | ||||
|     CTRL_COLOR = (80, 230, 150) | ||||
|     WIDTH = 0.4 | ||||
|     LENGTH = 0.6 | ||||
|     COLLISION_MARGIN = 0.4 | ||||
| @@ -82,6 +83,14 @@ class Car: | ||||
|         pts = [camera.world2screen(p) for p in pts] | ||||
|         pygame.draw.polygon(surf, self.COLOR, pts) | ||||
|  | ||||
|         if self.controller.is_connected: | ||||
|             pygame.draw.circle( | ||||
|                 surf, | ||||
|                 self.CTRL_COLOR, | ||||
|                 camera.world2screen(self.pos), | ||||
|                 camera.size2screen(self.WIDTH / 4), | ||||
|             ) | ||||
|  | ||||
|     def get_corners(self) -> list[Vec]: | ||||
|         u: Vec = self.direction * self.LENGTH / 2 | ||||
|         v: Vec = self.direction.perp * self.WIDTH / 2 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user