bogemaß war das problem
This commit is contained in:
parent
9d989a52a6
commit
bc77e0617f
1 changed files with 7 additions and 6 deletions
13
main copy.py
13
main copy.py
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/python3
|
||||
from math import sin,cos
|
||||
from math import sin,cos,radians
|
||||
from time import sleep
|
||||
import pygame
|
||||
def berechne_dreieck(alpha,c):
|
||||
alpha = radians(alpha)
|
||||
a = cos(alpha)*c# x
|
||||
b = sin(alpha)*c# y
|
||||
b = -sin(alpha)*c# y
|
||||
return a,b
|
||||
|
||||
def get_debug_text():
|
||||
|
@ -49,16 +50,16 @@ if __name__ == "__main__":
|
|||
screen.fill((0,0,0))
|
||||
if winkel >= 360 or winkel <= -1:
|
||||
winkel = 0
|
||||
a,b = berechne_dreieck(winkel,150)
|
||||
a,b = berechne_dreieck(winkel,200)#screensize[0]*screensize[1])
|
||||
|
||||
end_pos = start_pos[0]+a,start_pos[1]+b
|
||||
# draw c schwarz
|
||||
pygame.draw.line(screen,(0,0,0),start_pos,end_pos)
|
||||
pygame.draw.line(screen,(0,0,0),start_pos,end_pos,3)
|
||||
|
||||
# draw a rot
|
||||
pygame.draw.line(screen,(255,0,0),start_pos,(start_pos[0]+a,start_pos[1]))
|
||||
pygame.draw.line(screen,(255,0,0),start_pos,(start_pos[0]+a,start_pos[1]),3)
|
||||
# draw b blau
|
||||
pygame.draw.line(screen,(0,0,255),(start_pos[0]+a,start_pos[1]),(start_pos[0]+a,start_pos[1]+b))
|
||||
pygame.draw.line(screen,(0,0,255),(start_pos[0]+a,start_pos[1]),(start_pos[0]+a,start_pos[1]+b),3)
|
||||
|
||||
get_debug_text()
|
||||
pygame.display.flip()
|
||||
|
|
Loading…
Reference in a new issue