updated sonar logic

This commit is contained in:
OusmBlueNinja 2025-04-12 18:10:05 -05:00
parent bc92df3242
commit a9aefef662

View File

@ -140,8 +140,8 @@ while running:
if ray_y >= seafloor[int(ray_x)]:
blips.append((sonar_angle, i, now))
break
elif sonar_mode == "passive":
# Passive sonar "listens" and picks up nearby terrain noise randomly
for _ in range(2):
angle = random.uniform(0, 360)
distance = random.randint(30, sonar_radius)
@ -185,8 +185,12 @@ while running:
screen.blit(surf, (bx - 2, by - 2))
end_x = sonar_center[0] + math.cos(sweep_radians) * sonar_radius
end_y = sonar_center[1] + math.sin(sweep_radians) * sonar_radius
pygame.draw.line(screen, CYAN, sonar_center, (end_x, end_y), 2)
pygame.draw.circle(screen, CYAN, sonar_center, 3)
if sonar_mode == "active":
pygame.draw.line(screen, CYAN, sonar_center, (end_x, end_y), 2)
pygame.draw.circle(screen, CYAN, sonar_center, 3)
else:
pygame.draw.circle(screen, CYAN, sonar_center, 1)
mode_text = font.render(f"Sonar: {sonar_mode.upper()} (TAB)", True, WHITE)
screen.blit(mode_text, (sonar_center[0] - 60, sonar_center[1] + sonar_radius + 10))