Example #1
0
def init():
    global screen, clock, FPS, scr_size, center, manager
    pygame.init()
    FPS = 20
    scr_size = (width, height) = (800, 400)  # setting a sceen size
    center = coords(scr_size) / 2
    screen = pygame.display.set_mode(
        scr_size)  # creating a screen object using pygame.display class
    clock = pygame.time.Clock(
    )  # creating a clock object, used to provide delay to the objects
Example #2
0
def firsttime():
    global player_team
    planet=Planet(complex(0,0),sprites.AquaPlanet)
    planetteam=Team()
    for i in range(random.randrange(1,5)):
        ship=AiShip(planet,sprites.GreenShip)
        ship.weapon=weapons[0](ship)
        planetteam.register(ship)

    player=PlayerShip(coords((40,40)))
    player.weapon=weapons[1](player)
    guardian=AiShip(player,sprites.OrangeShip)
    guardian.weapon=weapons[0](guardian)
    player_team=Team(player,guardian)
Example #3
0
class Absolute(Drawable):
    focus = Drawable()
    focus.pos = coords((0, 0))

    def __init__(self, pos):
        self.init_absolute(coords(pos))

    def init_absolute(self, pos):
        self.init_drawable()
        self.pos = pos

    def draw(self):
        sprite_center = coords(self.image.get_rect().center)
        pos = center + self.pos - self.focus.pos - sprite_center
        screen.blit(self.image, (pos.real, pos.imag))
Example #4
0
 def draw(self):
     sprite_center = coords(self.image.get_rect().center)
     pos = center + self.pos - self.focus.pos - sprite_center
     screen.blit(self.image, (pos.real, pos.imag))
Example #5
0
 def __init__(self, pos):
     self.init_absolute(coords(pos))