Esempio n. 1
0
	def run(self):
		self.set_game_mode(invaderutils.GAME_STARTED_EVENT)

		try:
			while True:
				self.senario_change()
				self.remove_terminated()

				events = pygame.event.get()
				pressed = pygame.key.get_pressed()

				for event in events:
					self.process_events(event)

				for go in GameObjectKeeper.runables():
					for event in events:
						go.process_events(event)
					go.process_keys(pressed)

				self.collision_detection()

				for go in GameObjectKeeper.runables():
					go.draw(Background.get_screen())

				# Flip the drawing buffers
				pygame.display.flip()
				GameMachine.clock.tick(120)

		except QuitProgram as e_info:
			pass
Esempio n. 2
0
	def clear_all_objects(self):
		for go in GameObjectKeeper.runables():
			GameObjectKeeper.remove(go)
Esempio n. 3
0
	def remove_terminated(self):
		for go in GameObjectKeeper.runables():
			if (go.removeme()):
				GameObjectKeeper.remove(go)
				break