Compare commits
4 Commits
4d7a95545b
...
69e8ee5569
Author | SHA1 | Date | |
---|---|---|---|
69e8ee5569 | |||
4604f8224c | |||
3b2359aa41 | |||
e1010930b5 |
18
main.py
18
main.py
@ -87,12 +87,22 @@ def renderDebugInfo(gPlayer, clock, fontSize = 18):
|
||||
|
||||
return fps_surf, cPos_surf, cRot_surf
|
||||
|
||||
def make_wall(wall_buffer):
|
||||
if (len(wall_buffer) != 2):
|
||||
print('Warning: wall buffer not contains 2 points.')
|
||||
return
|
||||
|
||||
level.append(
|
||||
Segment(True, wall_buffer[0], wall_buffer[1], (23,74,183))
|
||||
)
|
||||
|
||||
def mainLoop():
|
||||
gPlayer = GyroVector(0,1)
|
||||
display = pygame.display.set_mode((1280,720))
|
||||
clock = pygame.time.Clock()
|
||||
fontSize = 18
|
||||
debugInfo = True
|
||||
wall_buffer = []
|
||||
|
||||
while True:
|
||||
for event in pygame.event.get():
|
||||
@ -103,6 +113,14 @@ def mainLoop():
|
||||
gPlayer.cRot *= -1
|
||||
if event.key == pygame.K_F3:
|
||||
debugInfo = not debugInfo
|
||||
if event.key == pygame.K_F2:
|
||||
if (len(wall_buffer) == 1):
|
||||
wall_buffer.append(gPlayer.cPos)
|
||||
make_wall(wall_buffer)
|
||||
wall_buffer.clear()
|
||||
else:
|
||||
wall_buffer.append(gPlayer.cPos)
|
||||
|
||||
keys = pygame.key.get_pressed()
|
||||
if keys[pygame.K_d]:
|
||||
gPlayer.rotate(ROT)
|
||||
|
Loading…
Reference in New Issue
Block a user