def main(): fl = open("assets/txt/SCORE.txt", "w") fl.write("0") fl.close() window_size = (1000, 750) title = "Space Reinvaders" g = Game(window_size, title) g.run()
def render(self): from engine.game_env import Game Game.get_surface().fill(self.bg) for br in self.bricks: br.render() self.ball.render() self.paddle.render()
def update(self, delta_ms): from engine.game_env import Game left = Game.get_key(K_a) or Game.get_key(K_LEFT) right = Game.get_key(K_d) or Game.get_key(K_RIGHT) if left: self.rect.centerx -= int(self.x_vel * delta_ms) if right: self.rect.centerx += int(self.x_vel * delta_ms)
def render(self): #Week 12 addition if self.game_over: self.bg = self.bg_won if self.game_won else self.bg_lost #Week 12 addition end from engine.game_env import Game Game.get_surface().fill(self.bg) for br in self.bricks: br.render() self.ball.render() self.paddle.render()
def render(self): if self.active: from engine.game_env import Game Brick.surf.fill(self.colour) Game.get_surface().blit(Brick.surf, self.rect)
def main(): g = Game() g.run() sys.exit()
def main(): window_size = (1024, 768) title = "Game" g = Game(window_size, title) g.run()
def render(self): from engine.game_env import Game Game.get_surface().blit(self.surf, self.rect)
def main(): g = Game(1024, 768, "my first pygame-engine") g.run()
def launch_ball(self): from pygame.locals import K_SPACE from engine.game_env import Game if Game.get_key(K_SPACE): self.ball.launch()
def main(): g = Game() g.run()
def render(self): from engine.game_env import Game Game.get_surface().fill(self.bg)
def main(): title = 'Game' window_size = (1280, 720) game = Game(window_size, title) game.run()