MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / controls

Method controls

projects/Space Shooter/main.py:465–479  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

463 self.down = False
464
465 def controls(self, event):
466 if event.type == pygame.KEYDOWN:
467 if event.key == pygame.K_w:
468 self.up = True
469 if event.key == pygame.K_s:
470 self.down = True
471
472 if event.type == pygame.KEYUP:
473 if event.key == pygame.K_w:
474 self.up = False
475 if event.key == pygame.K_s:
476 self.down = False
477
478 if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
479 self.object.insert_laser()
480
481 def movements(self):
482 if self.up and self.object.y >= 0:

Callers 1

executeMethod · 0.95

Calls 1

insert_laserMethod · 0.80

Tested by

no test coverage detected