Пример #1
0
    def run(self):
        for cred in self.text:
            r = cred[1]
            self.background(r)
            gfx.dirty(r)

        ratio = game.clockticks / 25
        speedadjust = max(ratio, 1.0)
        self.time += speedadjust

        gfx.updatestars(self.background, gfx)

        if not self.done:
            frame = int(self.time * .5) % len(self.r)
            surf = gfx.surface

            self.background(r.move(50, 400))
            self.background(r.move(300, 400))
            self.background(r.move(550, 400))
            gfx.dirty(surf.blit(self.r[frame], (50, 400)))
            gfx.dirty(surf.blit(self.g[frame], (300, 400)))
            gfx.dirty(surf.blit(self.b[frame], (550, 400)))

            for cred, pos in self.text:
                gfx.surface.blit(cred, pos)
Пример #2
0
    def run(self):
        self.step += 0.5
        self.starframe = (self.starframe + self.starinc) % 5

        if not self.done:
            self.clearletter(self.letter, self.letter)
        else:
            for img in self.fontimages:
                self.clearletter(img, self.letter)

        gfx.updatestars(self.background, gfx)

        if not self.done:
            r = gfx.surface.blit(self.stars[self.starframe], self.starrect)
            gfx.dirty(r)
            for img in self.fontimages:
                self.drawletter(img, self.letter)
            for img in self.images:
                r = gfx.surface.blit(img[0], img[1])
                gfx.dirty(r)
            self.drawname()
        else:
            for img in self.fontimages:
                gfx.dirty(img[1])
            for img in self.images:
                r = self.background(img[1])
                gfx.dirty(r)
            self.recalcname()
Пример #3
0
    def runobjects(self, objects):
        G, B, S = gfx, self.background, self.speedadjust
        gfx.updatestars(B, G)

        for effect in self.powereffects[:]:
            if effect.dead:
                effect.end()
                self.powereffects.remove(effect)
            else:
                effect.tick(S)

        # add pop for timedout powerups, sad place to do this, but owell
        for o in self.powerupobjs:
            if o.dead:
                self.popobjs.append(objpopshot.PopShot(o.rect.center))

        for l in objects:
            for o in l[:]:
                o.erase(B)
                o.tick(S)
                if o.dead:
                    o.erase(B)
                    l.remove(o)

        for l in objects:
            for o in l:
                o.draw(G)

        self.hud.draw()
Пример #4
0
    def run(self):
        r = self.background(self.images[0][1])
        gfx.dirty(r)

        self.moveship()
        gfx.updatestars(self.background, gfx)

        if not self.done:
            self.drawlist()
            for img in self.images:
                r = gfx.surface.blit(img[0], img[1])
                gfx.dirty(r)
        else:
            if gfx.rect.colliderect(self.images[0][1]) and not self.aborted:
                if self.current[0] >= 0:
                    g = self.gamelist[self.current[0]]
                    r = gfx.surface.blit(g[1][0], g[1][1])
                    gfx.dirty(r)
                for img in self.images:
                    r = gfx.surface.blit(img[0], img[1])
                    gfx.dirty(r)
            else:
                self.clearlist()
                if self.aborted:
                    game.handler = self.prevhandler
                else:
                    game.handler = gameplay.GamePlay(self.prevhandler)

            for img in self.images[1:]:
                r = self.background(img[1])
                gfx.dirty(r)
Пример #5
0
    def run(self):
        if self.rect:
            self.background(self.rect)
        gfx.updatestars(self.background, gfx)

        gfx.dirty(gfx.surface.blit(self.img_logo, (30, 25)))
        gfx.dirty(gfx.surface.blit(self.img_powered, (510, 490)))

        for b in self.blocks:
            gfx.dirty(gfx.surface.blit(*b))

        bar = pygame.Rect(self.rect)
        if load_total:
            bar.width = (float(load_current)/float(load_total)) * bar.width
            gfx.surface.fill((5, 50, 5), bar)
        r = pygame.Rect(self.rect.left, self.rect.bottom-2, self.rect.width, 2)
        gfx.surface.fill((20, 80, 30), r)
        gfx.surface.blit(self.text, self.textrect)
        gfx.dirty(self.rect)

        now = pygame.time.get_ticks()
        #we let the screen stay up for at about 1 second
        if not self.thread.isAlive():
            if load_finished_status >= 0:
                if now-self.starttime > 1200:
                    self.quit()
            else:
                if not self.handlederror:
                    msg = ('Fatal Error Loading Resources', load_finished_type, load_finished_message, 'Press Any Key To Quit')
                    self.buildblock(msg)
                    self.handlederror = 1
                if self.gotfinishinput:
                    self.quit()
Пример #6
0
    def run(self):
        for cred in self.text:
            r = cred[1]
            self.background(r)
            gfx.dirty(r)

        ratio = game.clockticks / 25
        speedadjust = max(ratio, 1.0)
        self.time += speedadjust

        gfx.updatestars(self.background, gfx)

        if not self.done:
            frame = int(self.time * .5) % len(self.r)
            surf = gfx.surface

            self.background(r.move(50, 400))
            self.background(r.move(300, 400))
            self.background(r.move(550, 400))
            gfx.dirty(surf.blit(self.r[frame], (50, 400)))
            gfx.dirty(surf.blit(self.g[frame], (300, 400)))
            gfx.dirty(surf.blit(self.b[frame], (550, 400)))

            for cred, pos in self.text:
                gfx.surface.blit(cred, pos)
Пример #7
0
    def runobjects(self, objects):
        G, B, S = gfx, self.background, self.speedadjust
        gfx.updatestars(B, G)

        for effect in self.powereffects[:]:
            if effect.dead:
                effect.end()
                self.powereffects.remove(effect)
            else:
                effect.tick(S)

        #add pop for timedout powerups, sad place to do this, but owell
        for o in self.powerupobjs:
            if o.dead:
                self.popobjs.append(objpopshot.PopShot(o.rect.center))

        for l in objects:
            for o in l[:]:
                o.erase(B)
                o.tick(S)
                if o.dead:
                    o.erase(B)
                    l.remove(o)

        #HERE IS THE GLITTER
        #self.glitter.update(S)
        #self.glitter.add(self.shotobjs, 1.0)

        for l in objects:
            for o in l:
                o.draw(G)

        self.hud.draw()
Пример #8
0
    def run(self):
        if self.rect:
            self.background(self.rect)
        gfx.updatestars(self.background, gfx)

        gfx.dirty(gfx.surface.blit(self.img_logo, (30, 25)))
        gfx.dirty(gfx.surface.blit(self.img_powered, (510, 490)))

        for b in self.blocks:
            gfx.dirty(gfx.surface.blit(*b))

        bar = Rect(self.rect)
        if load_total:
            bar.width = (float(load_current) / float(load_total)) * bar.width
            gfx.surface.fill((5, 50, 5), bar)
        r = Rect(self.rect.left, self.rect.bottom - 2, self.rect.width, 2)
        gfx.surface.fill((20, 80, 30), r)
        gfx.surface.blit(self.text, self.textrect)
        gfx.dirty(self.rect)

        now = pygame.time.get_ticks()
        #we let the screen stay up for at about 1 second
        if not self.thread.is_alive():
            if load_finished_status >= 0:
                if now - self.starttime > 1200:
                    self.quit()
            else:
                if not self.handlederror:
                    msg = ('Fatal Error Loading Resources', load_finished_type,
                           load_finished_message, 'Press Any Key To Quit')
                    self.buildblock(msg)
                    self.handlederror = 1
                if self.gotfinishinput:
                    self.quit()
Пример #9
0
    def run(self):
        self.step += 0.5
        self.starframe = (self.starframe + self.starinc) % 5

        if not self.done:
            self.clearletter(self.letter, self.letter)
        else:
            for img in self.fontimages:
                self.clearletter(img, self.letter)

        gfx.updatestars(self.background, gfx)

        if not self.done:
            r = gfx.surface.blit(self.stars[self.starframe], self.starrect)
            gfx.dirty(r)
            for img in self.fontimages:
                self.drawletter(img, self.letter)
            for img in self.images:
                r = gfx.surface.blit(img[0], img[1])
                gfx.dirty(r)
            self.drawname()
        else:
            for img in self.fontimages:
                gfx.dirty(img[1])
            for img in self.images:
                r = self.background(img[1])
                gfx.dirty(r)
            self.recalcname()
Пример #10
0
    def run(self):
        self.glow += .35
        self.boxtick = (self.boxtick + 1)%15
        boximg = self.boximages[self.boxtick]

        if self.startclock:
            alpha = (6-self.startclock)*40
            self.setalphas(alpha, [menu[self.current].img_on, boximg])
            self.background(self.boxrect)
        elif self.switchclock:
            alpha = (self.switchclock-1)*20
            self.setalphas(alpha, [boximg])
            self.background(self.boxrect)
            if self.switchclock == 2 and gfx.surface.get_bytesize()>1:
                menu[self.current].img_on.set_alpha(128)

        for m in menu:
            self.clearitem(m)

        gfx.updatestars(self.background, gfx)

        gfx.dirty(gfx.surface.blit(*self.version))
        if self.fame:
            gfx.dirty(gfx.surface.blit(*self.fame))

        if self.startclock == 1 or self.switchclock == 1:
            self.setalphas(255, [menu[self.current].img_on] + self.boximages)

        if self.switchclock != 1:
            r = gfx.surface.blit(boximg, self.boxrect)
            gfx.dirty(r)

            select = menu[self.current]
            for m in [m for m in menu if m is not select]:
                self.drawitem(m, 0)
            self.drawitem(select, 1)

        else:
            for m in menu:
                gfx.dirty(m.rect)
            if self.switchhandler == self.prevhandler:
                game.handler = self.prevhandler
            else:
                game.handler = self.switchhandler(self)
                self.switchclock = 0
                self.switchhandler = None
                self.startclock = 5
            if self.fame:
                gfx.dirty(self.background(self.fame[1]))
            gfx.dirty(self.background(self.version[1]))
            gfx.dirty(gfx.surface.fill((0, 0, 0), self.logorect))
            gfx.dirty(gfx.surface.fill((0, 0, 0), self.bigshiprect))

        if self.startclock:
            self.startclock -= 1
        elif self.switchclock:
            self.switchclock -= 1
Пример #11
0
    def run(self):
        self.glow += .35
        self.boxtick = (self.boxtick + 1)%15
        boximg = self.boximages[self.boxtick]

        if self.startclock:
            alpha = (6-self.startclock)*40
            self.setalphas(alpha, [menu[self.current].img_on, boximg])
        elif self.switchclock:
            alpha = (self.switchclock-1)*20
            self.setalphas(alpha, [boximg])
            if self.switchclock == 2 and gfx.surface.get_bytesize()>1:
                menu[self.current].img_on.set_alpha(128)

        for m in menu:
            self.clearitem(m)

        gfx.updatestars(self.background, gfx)

        gfx.dirty(gfx.surface.blit(*self.version))
        if self.fame:
            gfx.dirty(gfx.surface.blit(*self.fame))

        if self.startclock == 1 or self.switchclock == 1:
            self.setalphas(255, [menu[self.current].img_on] + self.boximages)

        self.background(self.boxrect)
        gfx.dirty(self.boxrect)

        if self.switchclock != 1:
            gfx.surface.blit(boximg, self.boxrect)
            
            select = menu[self.current]
            for m in [m for m in menu if m is not select]:
                self.drawitem(m, 0)
            self.drawitem(select, 1)

        else:
            for m in menu:
                gfx.dirty(m.rect)
            if self.switchhandler == self.prevhandler:
                game.handler = self.prevhandler
            else:
                game.handler = self.switchhandler(self)
                self.switchclock = 0
                self.switchhandler = None
                self.startclock = 5
            if self.fame:
                gfx.dirty(self.background(self.fame[1]))
            gfx.dirty(self.background(self.version[1]))
            gfx.dirty(gfx.surface.fill((0, 0, 0), self.logorect))
            gfx.dirty(gfx.surface.fill((0, 0, 0), self.bigshiprect))

        if self.startclock:
            self.startclock -= 1
        elif self.switchclock:
            self.switchclock -= 1
Пример #12
0
    def run(self):
        self.clocks += 1
        self.cleartext()

        if self.thread and (not self.thread.isAlive() and self.success):
            self.download_finished()

        clearme = None
        if self.lastdownrect:
            gfx.dirty(self.background(self.lastdownrect))
            clearme = self.lastdownrect
            self.lastdownrect = None

        r = self.background(self.shipimage[1])
        gfx.dirty(r)

        gfx.updatestars(self.background, gfx)

        if not self.done:
            for img, r in self.images:
                gfx.dirty(gfx.surface.blit(img, r))
            downimg, downrect = self.downimg()
            if downimg:
                self.lastdownrect = gfx.surface.blit(downimg, downrect)
                gfx.dirty2(self.lastdownrect, clearme)

            for text, pos in self.imgs:
                gfx.surface.blit(text, pos)
        else:
            for img, r in self.images:
                gfx.dirty(self.background(r))
            gfx.dirty(clearme)

        if not self.done:
            self.drawlist()
            self.moveship()
            r = gfx.surface.blit(self.shipimage[0], self.shipimage[1])
            gfx.dirty(r)
            for b in self.boxes:
                b.erase(self.background)
                b.tick(1.0)
                b.draw(gfx)
        else:
            #game.handler = self.prevhandler
            for b in self.boxes:
                b.erase(self.background)
            self.clearlist()

        if self.launchthebrowser:
            #we do it like this so the window can get
            #unfullscreened and not minimized on windows
            self.launchthebrowser -= 1
            if not self.launchthebrowser:
                webbrowser.open(game.site_url, 1, 1)
Пример #13
0
    def run(self):
        self.clocks += 1
        self.cleartext()

        if self.thread and (not self.thread.isAlive() and self.success):
            self.download_finished()

        clearme = None
        if self.lastdownrect:
            gfx.dirty(self.background(self.lastdownrect))
            clearme = self.lastdownrect
            self.lastdownrect = None

        r = self.background(self.shipimage[1])
        gfx.dirty(r)

        gfx.updatestars(self.background, gfx)

        if not self.done:
            for img, r in self.images:
                gfx.dirty(gfx.surface.blit(img, r))
            downimg, downrect = self.downimg()
            if downimg:
                self.lastdownrect = gfx.surface.blit(downimg, downrect)
                gfx.dirty2(self.lastdownrect, clearme)

            for text, pos in self.imgs:
                gfx.surface.blit(text, pos)
        else:
            for img, r in self.images:
                gfx.dirty(self.background(r))
            gfx.dirty(clearme)

        if not self.done:
            self.drawlist()
            self.moveship()
            r = gfx.surface.blit(self.shipimage[0], self.shipimage[1])
            gfx.dirty(r)
            for b in self.boxes:
                b.erase(self.background)
                b.tick(1.0)
                b.draw(gfx)
        else:
            #game.handler = self.prevhandler
            for b in self.boxes:
                b.erase(self.background)
            self.clearlist()

        if self.launchthebrowser:
            #we do it like this so the window can get
            #unfullscreened and not minimized on windows
            self.launchthebrowser -= 1
            if not self.launchthebrowser:
                webbrowser.open(game.site_url, 1, 1)
Пример #14
0
    def run(self):
        gfx.updatestars(self.background, gfx)
        self.ticks -= 1
        if not self.started:
            self.started = 1
            if snd.music:
                snd.music.fadeout(15*game.clockticks)

        if not self.ticks:
            gfx.surface.fill(0)
            pygame.display.update()
            #pygame.time.delay(200)
            game.handler = self.prevhandler
Пример #15
0
    def run(self):
        gfx.updatestars(self.background, gfx)
        self.ticks -= 1
        if not self.started:
            self.started = 1
            if snd.music:
                snd.music.fadeout(15*game.clockticks)

        if not self.ticks:
            gfx.surface.fill(0)
            pygame.display.update()
            #pygame.time.delay(200)
            game.handler = self.prevhandler
Пример #16
0
    def run(self):
        if self.first:
            gfx.dirty(gfx.rect)
            self.first = 0
        ratio = game.clockticks / 25
        speedadjust = max(ratio, 1.0)

        self.offset += speedadjust * 1.0
        offsety = self.area.bottom-self.offset

        oldclip = gfx.surface.get_clip()


        gfx.surface.blit(self.darkpic, self.area)

        gfx.updatestars(self.background, gfx)

        item = 0.0
        if not self.done:
            for cred, pos in self.text:
                gfx.surface.blit(cred, pos)
            gfx.surface.set_clip(self.area)
            for cred, pos in self.credits:
                offsetx = math.cos(self.offset * .04 + item)*30.0
                item -= 0.25
                r = pos.move(offsetx, offsety)
                bottom = r.bottom
                gfx.surface.blit(cred, r)
                #gfx.dirty(gfx.surface.blit(cred, r))
            gfx.surface.set_clip(oldclip)
            gfx.dirty(self.area)

            for y,h in self.fade:
                r = pygame.Rect(self.area.left, self.area.top+y, self.area.width, h)
                self.background(r)
                r = pygame.Rect(self.area.left, self.area.bottom-y-h, self.area.width, h)
                self.background(r)

            if bottom < self.area.top:
                self.offset = 0.0

        else:
            for text in self.text:
                r = text[1]
                gfx.dirty(self.background(text[1]))
Пример #17
0
    def run(self):
        r = self.background(self.images[0][1])
        gfx.dirty(r)

        self.moveship()
        gfx.updatestars(self.background, gfx)

        if not self.done:
            self.drawlist()
            for img in self.images:
                r = gfx.surface.blit(img[0], img[1])
                gfx.dirty(r)
        else:
            game.handler = self.prevhandler
            self.clearlist()
            for img in self.images[1:]:
                r = self.background(img[1])
                gfx.dirty(r)
Пример #18
0
    def run(self):
        r = self.background(self.images[0][1])
        gfx.dirty(r)

        self.moveship()
        gfx.updatestars(self.background, gfx)

        if not self.done:
            self.drawlist()
            for img in self.images:
                r = gfx.surface.blit(img[0], img[1])
                gfx.dirty(r)
        else:
            game.handler = self.prevhandler
            self.clearlist()
            for img in self.images[1:]:
                r = self.background(img[1])
                gfx.dirty(r)
Пример #19
0
    def run(self):
        r = self.background(self.images[0][1])
        gfx.dirty(r)

        self.moveship()
        gfx.updatestars(self.background, gfx)

        if self.inputstate != DONE:
            self.drawactionlist()
            self.drawstatus()
            for img in self.images:
                r = gfx.surface.blit(img[0], img[1])
                gfx.dirty(r)
        else:
            self.clearactionlist()
            self.clearstatus()
            game.handler = self.prevhandler

            for img in self.images[1:]:
                r = self.background(img[1])
                gfx.dirty(r)
Пример #20
0
    def run(self):
        r = self.background(self.images[0][1])
        gfx.dirty(r)

        self.moveship()
        gfx.updatestars(self.background, gfx)

        if self.inputstate != DONE:
            self.drawactionlist()
            self.drawstatus()
            for img in self.images:
                r = gfx.surface.blit(img[0], img[1])
                gfx.dirty(r)
        else:
            self.clearactionlist()
            self.clearstatus()
            game.handler = self.prevhandler

            for img in self.images[1:]:
                r = self.background(img[1])
                gfx.dirty(r)