#๐Ÿ”’ Pygame change canon angle depending on cursor placement

6 messages ยท Page 1 of 1 (latest)

west impBOT
#

@ancient talon

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

ancient talon
#

CustomFunctions module:


def draw_dotted_line(surface, color, start_pos, end_pos, dot_size=5, space_size=5):
    x1, y1 = start_pos
    x2, y2 = end_pos
    
    total_distance = ((x2 - x1)**2 + (y2 - y1)**2)**0.5
    
    num_dots = int(total_distance // (dot_size + space_size))
    
    for i in range(num_dots + 1):
        if not i == 0:
            
            t = i / num_dots
            x = int(x1 + (x2 - x1) * t)
            y = int(y1 + (y2 - y1) * t)
            pygame.draw.circle(surface, color, (x, y), dot_size)```
ancient talon
#

!close

west impBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.