def init(): global clock, game_dimensions, width, height, camera, player_id pygame.init() clock = 0 game_dimensions = width, height = 640, 480 draw.init(width, height) camera = Camera(width, height) entity_control.init() player_ship = load_texture('graphics\\ship.tif', 'player_ship') bullet1 = load_texture('graphics\\bullet_6x6.tif', 'bullet1') target1 = load_texture('graphics\\target_30x30.tif', 'target1') dust1 = load_texture('graphics\\layers\\dust_640x480_1.tif', 'dust1') dust2 = load_texture('graphics\\layers\\dust_640x480_2.tif', 'dust2') dust3 = load_texture('graphics\\layers\\dust_800x800_1.tif', 'dust3') planet1 = load_texture('graphics\\layers\\planet_154x154_1.tif', 'planet1') planet2 = load_texture('graphics\\layers\\planet_40x40_1.tif', 'planet2') starfield = load_texture('graphics\\layers\\starfield_640x480_1.tif', 'starfield') #test1 = load_texture('graphics\\layers\\test_640x480.tif', 'test1') shape = Polygon([Pnt(0,-15),Pnt(10,15), Pnt(-10,15)], Pnt()) player = entity.Player(player_ship, shape, 0.0005, 0.2, 0.005, bullet1) player_id = entity_control.register(player, 'player') """ orb = entity.Entity(bullet1, Circle(3)) orb_logic = logic.Orbital_Logic(Pnt(0,40), 0.004, 0) orb.socket_logic(orb_logic) player.add_child(orb) entity_control.register(orb) orb = entity.Entity(bullet1, Circle(3)) orb_logic = logic.Orbital_Relative_Logic(Pnt(0,30), 0) orb.socket_logic(orb_logic) player.add_child(orb) entity_control.register(orb) orb = entity.Entity(bullet1, Circle(3)) orb_logic = logic.Orbital_Static_Logic(Pnt(0,20), 0) orb.socket_logic(orb_logic) player.add_child(orb) entity_control.register(orb) """ enemy = entity.Enemy(target1, Circle(15), Pnt(300, 300), 0.0003, 0.2) enemy_logic = logic.Enemy_Basic_Logic('player') enemy.socket_logic(enemy_logic) entity_control.register(enemy) enemy = entity.Enemy(target1, Circle(15), Pnt(-300, 300), 0.0003, 0.2) enemy_logic = logic.Enemy_Basic_Logic('player') enemy.socket_logic(enemy_logic) entity_control.register(enemy) enemy = entity.Enemy(target1, Circle(15), Pnt(0, -300), 0.0003, 0.19) enemy_logic = logic.Enemy_Basic_Logic('player') enemy.socket_logic(enemy_logic) entity_control.register(enemy) entity_control.register(background.Background_scrolling(dust1, 0.5, 4)) entity_control.register(background.Background_scrolling(dust2, 1.0, 3)) entity_control.register(background.Background_scrolling(dust3, 2.0, 3)) entity_control.register(background.Background_object(Pnt(300, 100), planet1, 4, 2)) entity_control.register(background.Background_object(Pnt(550, -200), planet2, 6, 1)) entity_control.register(background.Background_scrolling(starfield, 20, 0)) for e in entity_control.yield_entities(): e.set_camera(camera)
def input_shoot(self): if self.timer >= self.cooldown and input.player_shoot: bullet = Projectile(self.bullet_texture, Point(), self.pos, self.dir, 0.4, self.velocity, 3000) bullet.set_camera(self.camera) entity_control.register(bullet) self.timer = 0