forked from bedohswe/p3he
A commit.
This commit is contained in:
parent
6b4380d130
commit
2d08605590
17
main.py
17
main.py
@ -12,7 +12,7 @@ def deg2rad(rA): return rA/180*PI
|
|||||||
|
|
||||||
WHITE = (255,255,255)
|
WHITE = (255,255,255)
|
||||||
BLACK = (0,0,0)
|
BLACK = (0,0,0)
|
||||||
OFFSET = .015625
|
OFFSET = 0.015625
|
||||||
I = complex(0,1)
|
I = complex(0,1)
|
||||||
PI = 3.14159265358979323846264338327
|
PI = 3.14159265358979323846264338327
|
||||||
ROT = cNorm(exp(deg2rad(2)*I))
|
ROT = cNorm(exp(deg2rad(2)*I))
|
||||||
@ -34,7 +34,9 @@ class DrawnSegment:
|
|||||||
self.color = color
|
self.color = color
|
||||||
|
|
||||||
level = [
|
level = [
|
||||||
# Segment(False,cNorm(-1),cNorm(I),(255,255,20)),
|
Segment(False,.5,I*.5,(255,0,0)),
|
||||||
|
Segment(False,.5,-I*.5,(0,255,0)),
|
||||||
|
Segment(False,-.5,-I*.5,(0,0,255)),
|
||||||
Segment(False,-.5,I*.5,BLACK)
|
Segment(False,-.5,I*.5,BLACK)
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -75,15 +77,18 @@ def mainLoop():
|
|||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
return True
|
return True
|
||||||
|
if event.type == pygame.KEYDOWN:
|
||||||
|
if event.key == pygame.K_q:
|
||||||
|
gPlayer.cRot *= -1
|
||||||
keys = pygame.key.get_pressed()
|
keys = pygame.key.get_pressed()
|
||||||
if keys[pygame.K_d]:
|
if keys[pygame.K_d]:
|
||||||
gPlayer.rotate(IROT)
|
|
||||||
if keys[pygame.K_a]:
|
|
||||||
gPlayer.rotate(ROT)
|
gPlayer.rotate(ROT)
|
||||||
|
if keys[pygame.K_a]:
|
||||||
|
gPlayer.rotate(IROT)
|
||||||
if keys[pygame.K_w]:
|
if keys[pygame.K_w]:
|
||||||
gPlayer += GyroVector(OFFSET, 1)
|
|
||||||
if keys[pygame.K_s]:
|
|
||||||
gPlayer -= GyroVector(OFFSET, 1)
|
gPlayer -= GyroVector(OFFSET, 1)
|
||||||
|
if keys[pygame.K_s]:
|
||||||
|
gPlayer += GyroVector(OFFSET, 1)
|
||||||
display.fill(WHITE)
|
display.fill(WHITE)
|
||||||
#pygame.draw.rect(display,BLACK, c_tr(Poincare2Klein(gPlayer.cPos) * -100) + (100,100),0)
|
#pygame.draw.rect(display,BLACK, c_tr(Poincare2Klein(gPlayer.cPos) * -100) + (100,100),0)
|
||||||
drawn = draw(level,gPlayer,PI/2,640)
|
drawn = draw(level,gPlayer,PI/2,640)
|
||||||
|
Loading…
Reference in New Issue
Block a user