Esempio n. 1
0
    def __init__(self, size, ui):
        Ship.imageCache = Screen.imageCache
        Boulder.imageCache = Screen.imageCache
        BoulderFragment.imageCache = Screen.imageCache
        ScrollingCodeBackground.textCache = Screen.textCache
        ScrollingCodeBackground.resolution = Screen.resolution
        Counter.textCache = Screen.textCache
        Counter.resolution = Screen.resolution

        background = ScrollingCodeBackground()
        Screen.__init__(self, background, size, ui)

        self.ships = pygame.sprite.Group()
        ship = Ship(self, pos=(size[0]/2,size[1]), screenBoundaries=(0,0)+size)
        self.ships.add(ship) #May change if we add more ships (multiplayer?)
        for ship in self.ships:
            ship.move((0,-ship.rect.height/2))
            ship.targetPosition = ship.position

        self.boulders = pygame.sprite.Group()
        self.nextBoulderTime = 0

        self.boulderFragments = pygame.sprite.Group()

        self.healthBar = Bar(100,int(size[0]*0.72),int(size[1]*0.05),fullColor=(255,0,0),emptyColor=(0,0,0), borderSize=int(size[1]*0.005), borderColor=(255,255,255))

        self.scoreDisplay = Counter(0,(self.healthBar.surface.get_rect().width,0))

        musicPath = pathJoin(('music','Music.ogg'))
        pygame.mixer.music.load(musicPath)
        pygame.mixer.music.play(-1)
Esempio n. 2
0
    def __init__(self, size, ui):
        background = Background((0, 0, 0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache
        Ship.imageCache = Screen.imageCache

        self.ship = TestShip(self,
                             pos=(size[0] / 2, size[1]),
                             screenBoundaries=(0, 0) + size)
        self.ship.move((0, -self.ship.rect.height / 2))

        self.menuItems = []
        self.addMenuItem(
            MenuItem('You are about to calibrate your eye circuit',
                     (self.resolution[0] // 2, int(self.resolution[1] * .1)),
                     scaleSize=.75))
        self.addMenuItem(
            MenuItem('Follow the ship with your eyes',
                     (self.resolution[0] // 2, int(self.resolution[1] * .17)),
                     scaleSize=.75))
        self.addMenuItem(
            MenuItem('Start',
                     (self.resolution[0] // 2, int(self.resolution[1] * .31)),
                     scaleSize=.75))

        self.shipPositions = []
        self.eyePositions = []

        self.running = False
Esempio n. 3
0
    def __init__(self, size, ui, score):
        background = Background((0,0,0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache

        self.menuItems = []
        self.title = MenuItem('Game Over',(self.resolution[0]//2,int(self.resolution[1]*.15)), scaleSize=1.5)
        self.addMenuItem(MenuItem('Score: %d' % (score,),(self.resolution[0]//2, int(self.resolution[1]*.3))))
        self.addMenuItem(MenuItem('Replay',(int(self.resolution[0]*.3),self.resolution[1]//2)))
        self.addMenuItem(MenuItem('Main Menu',(int(self.resolution[0]*.7),self.resolution[1]//2)))
Esempio n. 4
0
    def __init__(self, size, ui):
        background = Background((0,0,0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache
        MenuItem.resolution = Screen.resolution

        self.title = MenuItem('Options',(self.resolution[0]//2,int(self.resolution[1]/4)), scaleSize=1.5)
        self.menuItems = []
        self.addMenuItem(MenuItem('Back',(int(self.resolution[0]*(2/3.0)),self.resolution[1]//2)))
        self.addMenuItem(MenuItem('Calibrate',(int(self.resolution[0]*(1/3.0)),self.resolution[1]//2,)))
        #self.addMenuItem(MenuItem('Input Settings',(int(self.resolution[0]*.5),self.resolution[1]//2)))

        self.organizeMenuItems()
Esempio n. 5
0
    def __init__(self, size, ui):
        background = Background((0,0,0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache
        MenuItem.imageCache = Screen.imageCache
        MenuItem.resolution = Screen.resolution

        self.menuItems = []
        self.title = MenuItem('MindRush',(self.resolution[0]//2,int(self.resolution[1]/4)), scaleSize=1.5)
        self.addMenuItem(MenuItem('Play',(int(self.resolution[0]*(1/3.0)),self.resolution[1]//2,)))
        self.addMenuItem(MenuItem('Options',(int(self.resolution[0]*.5),self.resolution[1]//2)))
        self.addMenuItem(MenuItem('Exit',(int(self.resolution[0]*(2/3.0)),self.resolution[1]//2)))

        self.organizeMenuItems()
Esempio n. 6
0
    def __init__(self, size, ui):
        background = Background((0,0,0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache
        Ship.imageCache = Screen.imageCache

        self.ship = TestShip(self, pos=(size[0]/2,size[1]), screenBoundaries=(0,0)+size)
        self.ship.move((0,-self.ship.rect.height/2))

        self.menuItems = []
        self.addMenuItem(MenuItem('You are about to calibrate your eye circuit',(self.resolution[0]//2,int(self.resolution[1]*.1)),scaleSize=.75))
        self.addMenuItem(MenuItem('Follow the ship with your eyes',(self.resolution[0]//2,int(self.resolution[1]*.17)),scaleSize=.75))
        self.addMenuItem(MenuItem('Start',(self.resolution[0]//2,int(self.resolution[1]*.31)),scaleSize=.75))

        self.shipPositions = []
        self.eyePositions = []

        self.running = False
Esempio n. 7
0
    def __init__(self, size, ui, score):
        background = Background((0, 0, 0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache

        self.menuItems = []
        self.title = MenuItem(
            'Game Over',
            (self.resolution[0] // 2, int(self.resolution[1] * .15)),
            scaleSize=1.5)
        self.addMenuItem(
            MenuItem('Score: %d' % (score, ),
                     (self.resolution[0] // 2, int(self.resolution[1] * .3))))
        self.addMenuItem(
            MenuItem('Replay',
                     (int(self.resolution[0] * .3), self.resolution[1] // 2)))
        self.addMenuItem(
            MenuItem('Main Menu',
                     (int(self.resolution[0] * .7), self.resolution[1] // 2)))
Esempio n. 8
0
    def __init__(self, size, ui):
        background = Background((0, 0, 0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache
        MenuItem.resolution = Screen.resolution

        self.title = MenuItem(
            'Options', (self.resolution[0] // 2, int(self.resolution[1] / 4)),
            scaleSize=1.5)
        self.menuItems = []
        self.addMenuItem(
            MenuItem('Back', (int(self.resolution[0] *
                                  (2 / 3.0)), self.resolution[1] // 2)))
        self.addMenuItem(
            MenuItem('Calibrate', (
                int(self.resolution[0] * (1 / 3.0)),
                self.resolution[1] // 2,
            )))
        #self.addMenuItem(MenuItem('Input Settings',(int(self.resolution[0]*.5),self.resolution[1]//2)))

        self.organizeMenuItems()
Esempio n. 9
0
    def __init__(self, size, ui):
        Ship.imageCache = Screen.imageCache
        Boulder.imageCache = Screen.imageCache
        BoulderFragment.imageCache = Screen.imageCache
        ScrollingCodeBackground.textCache = Screen.textCache
        ScrollingCodeBackground.resolution = Screen.resolution
        Counter.textCache = Screen.textCache
        Counter.resolution = Screen.resolution

        background = ScrollingCodeBackground()
        Screen.__init__(self, background, size, ui)

        self.ships = pygame.sprite.Group()
        ship = Ship(self,
                    pos=(size[0] / 2, size[1]),
                    screenBoundaries=(0, 0) + size)
        self.ships.add(ship)  #May change if we add more ships (multiplayer?)
        for ship in self.ships:
            ship.move((0, -ship.rect.height / 2))
            ship.targetPosition = ship.position

        self.boulders = pygame.sprite.Group()
        self.nextBoulderTime = 0

        self.boulderFragments = pygame.sprite.Group()

        self.healthBar = Bar(100,
                             int(size[0] * 0.72),
                             int(size[1] * 0.05),
                             fullColor=(255, 0, 0),
                             emptyColor=(0, 0, 0),
                             borderSize=int(size[1] * 0.005),
                             borderColor=(255, 255, 255))

        self.scoreDisplay = Counter(
            0, (self.healthBar.surface.get_rect().width, 0))

        musicPath = pathJoin(('music', 'Music.ogg'))
        pygame.mixer.music.load(musicPath)
        pygame.mixer.music.play(-1)
Esempio n. 10
0
    def __init__(self, size, ui):
        background = Background((0, 0, 0))
        Screen.__init__(self, background, size, ui)
        MenuItem.textCache = Screen.textCache
        MenuItem.imageCache = Screen.imageCache
        MenuItem.resolution = Screen.resolution

        self.menuItems = []
        self.title = MenuItem(
            'MindRush', (self.resolution[0] // 2, int(self.resolution[1] / 4)),
            scaleSize=1.5)
        self.addMenuItem(
            MenuItem('Play', (
                int(self.resolution[0] * (1 / 3.0)),
                self.resolution[1] // 2,
            )))
        self.addMenuItem(
            MenuItem('Options',
                     (int(self.resolution[0] * .5), self.resolution[1] // 2)))
        self.addMenuItem(
            MenuItem('Exit', (int(self.resolution[0] *
                                  (2 / 3.0)), self.resolution[1] // 2)))

        self.organizeMenuItems()
Esempio n. 11
0
 def __init__(self, size, ui):
     Screen.__init__(self, None, size, ui)
     self.setup()