Exemple #1
0
 def drawAttributeBars(self, displaySurface):
     # 179 x,y 20,y 28,y 36,y 62 wide.
     barWidthRatio = ((g.width/320)*62)/100
     
     
     growingBar = h.createBar(self.redBar, int(barWidthRatio*self.crewPointer.skill), int((g.height/200)*3)+1)
     displaySurface.blit(growingBar, (int((g.width/320)*179), int((g.height/200)*20)))
     
     growingBar = h.createBar(self.redBar, int(barWidthRatio*self.crewPointer.performance), int((g.height/200)*3)+1)
     displaySurface.blit(growingBar, (int((g.width/320)*179), int((g.height/200)*28)))
     
     growingBar = h.createBar(self.redBar, int(barWidthRatio*self.crewPointer.sanity), int((g.height/200)*3)+1)
     displaySurface.blit(growingBar, (int((g.width/320)*179), int((g.height/200)*36)))
Exemple #2
0
 def drawEncodeBar(self, surface, xPosition, yPosition):
     
         currentTimer = 4
         
         #  Set green light to red next to bar.
         if self.count <= 37:
             
             growingBar = h.createBar(self.redBar, int((g.width/320)*self.count), int((g.height/200)*2)+1)
             surface.blit(growingBar, (int((g.width/320)*xPosition), int((g.height/200)*yPosition)))
             
         else:
             
             self.encodeStep += 1
             self.count = 0
             self.stopwatch.resetStopwatch()  #  If we beat the timer.
Exemple #3
0
    def ironseedCrash(self, width, height, displaySurface):
        
        displaySurface.fill(g.BLACK)
        displaySurface.blit(self.ironseedScaled, (0, 0))
        
        finished = False
        currentTimer = 0
        #  Bar reduction steps.  These appear to be no x 10 percentages.
        # -1,0,0,-2
        # -3,0,-1-1
        # -1,-1,0,0
        
        #  11, 159 - text box location.

        #  Bar bounding box parameters.
        #  (X to X), (Y to Y)  104 wide, 10 high.
        #  (186,290), (35,45) - Hull integrity bar. 100%
        
        #  (186,200), (55,65) - Primary Power.  10% ?
        
        #  (186,233), (75,85) - Auxiliary power. 40% ?
        
        #  (186,279), (95,105) - Shield Strength. 90% ?
        
        barLengths = {0:(290, 200, 233, 279), 1:(280, 200, 233, 259),
                      2:(250, 200, 223, 249), 3:(240, 190, 223, 249),
                      4:(240, 190, 223, 249), 5:(240, 190, 223, 249)}
        
        if self.crashLandingStep >= 1 and self.crashLandingStep <= 3 and self.count <= 10:
            
            tempLengths = [0,0,0,0]
            
            for index in range(0, 4):
                
                tempLength = barLengths[self.crashLandingStep-1][index] - barLengths[self.crashLandingStep][index]
                tempLength /= 10  #  Based on 100ms per second.
                tempLengths[index] = barLengths[self.crashLandingStep-1][index] - int(tempLength * self.count)
                
            barLengths[self.crashLandingStep] = (tempLengths[0], tempLengths[1],
                                                 tempLengths[2], tempLengths[3])
            
        defaultBar = h.colourLine(int((g.width/320)*110), g.BLUE)
        
        barLineHull = h.createBar(defaultBar, int((g.width/320)*(barLengths[self.crashLandingStep][0]-186)), int(g.height/200*10))
        barLinePri = h.createBar(defaultBar, int((g.width/320)*(barLengths[self.crashLandingStep][1]-186)), int(g.height/200*10))
        barLineAux = h.createBar(defaultBar, int((g.width/320)*(barLengths[self.crashLandingStep][2]-186)), int(g.height/200*10))
        barLineShld = h.createBar(defaultBar, int((g.width/320)*(barLengths[self.crashLandingStep][3]-186)), int(g.height/200*10))

        #  Render planet here.
        readyPlanet = pygame.Surface((g.planetWidth, g.planetHeight), 0)
        readyPlanet.set_colorkey(g.BLACK)
        terrainStart = self.crashLandingStep % (g.planetWidth+1)
        planets.Planets["Icarus"].planetBitmapToSphere(readyPlanet, terrainStart, eclipse = True)
        displaySurface.blit(readyPlanet,(int(g.width/16),int(g.height/8)))
        
        #  Render text and bars.
        
        if self.crashLandingStep <= 4:
            
            currentTimer = 2
            h.renderText(self.introText7[0:self.crashLandingStep], g.font,
                         displaySurface, g.WHITE, g.offset,
                         int((g.width/320)*11), int((g.height/200)*159))
            
            # Draw Bars.
            displaySurface.blit(barLineHull, (int((g.width/320)*186), int((g.height/200)*35)), None, pygame.BLEND_MULT)
            displaySurface.blit(barLinePri, (int((g.width/320)*186), int((g.height/200)*55)), None, pygame.BLEND_MULT)
            displaySurface.blit(barLineAux, (int((g.width/320)*186), int((g.height/200)*75)), None, pygame.BLEND_MULT)
            displaySurface.blit(barLineShld, (int((g.width/320)*186), int((g.height/200)*95)), None, pygame.BLEND_MULT)
            
            # TODO: These bars need to reduce in length smoothly from one value to the next.
            
        else:
            
            finished = True
        
        #  Our timer for this sequence.
        if h.GameStopwatch.stopwatchSet:
            
            if h.GameStopwatch.getElapsedStopwatch() > currentTimer:
                
                h.GameStopwatch.resetStopwatch()
                self.crashLandingStep += 1
                self.count = 0
                
        else:
            
            h.GameStopwatch.setStopwatch()
        
        return finished
Exemple #4
0
    def __init__(self):

        
        self.creditText = ["1994 Channel 7, Destiny: Virtual",
                           "Released Under GPL V3.0 in 2013 by Jeremy D Stanton of IronSeed.net",
                           "2013 y-salnikov - Converted IronSeed to FreePascal and GNU/Linux",
                           "2016 Nuke Bloodaxe - Code Tidying",
                           "2020 Nuke Bloodaxe - Complete Python Refactor/Rewrite",
                           "All rights reserved."]
        self.versionText = ["Ironseed", g.version] #  Ridiculous version string required...
        self.introText1 = ["A","Destiny: Virtual", "Designed Game"]
        self.introText2 = ["Mars", "3784 A.D."]
        self.introText3 = ["Escaping the iron fist of a fanatical",
                          "theocracy, the members of the Ironseed",
                          "Movement launch into space and are set",
                          "adrift after suffering a computer",
                          "malfunction"]
        self.introText4 = ["Ship IRONSEED to Relay Point:",
                           "Link Established.",
                           "Receiving Encode Variants.",
                           "Wiping Source Encodes.",
                           "Terminating Transmission.",
                           'Control Protocol Transfered to Human Encode "PRIME".']
                        #  Que Transformers theme...
        self.introText5 = ["As captain, you awaken along with the",
                           "crew some thousand years later and are",
                           "confronted by an alien horde..."]
        self.introText6 = ["Orders: Approach and Destroy.",
                           "Jamming all Emissions.",
                           "Targeting...",
                           "Locked and Loading...",
                           "Closing for Fire..."]
        self.introText7 = ["Enemy Closing Rapidly...",
                           "Shields Imploding...",
                           "Destruction Imminent.",
                           "Attempting Crash Landing."]
        self.introText8 = ["They threaten to devour all life in",
                           "their path...your only hope of defeating",
                           "the Scavengers is to reunite the Kendar,",
                           "an ancient alliance among the free",
                           "worlds."]
        self.starField = pygame.image.load(os.path.join('Graphics_Assets', 'cloud.png'))
        self.channel7Logo = pygame.image.load(os.path.join('Graphics_Assets', 'channel7.png'))
        self.mars = pygame.image.load(os.path.join('Graphics_Assets', 'world.png'))
        self.charCom = pygame.image.load(os.path.join('Graphics_Assets', 'charcom.png'))
        self.redLight = pygame.image.load(os.path.join('Graphics_Assets', 'CrewCom_RED.png'))
        self.battle = pygame.image.load(os.path.join('Graphics_Assets', 'battle1.png'))
        self.alienShip = pygame.image.load(os.path.join('Graphics_Assets', 'alien.png'))
        self.ship = pygame.image.load(os.path.join('Graphics_Assets', 'ship1.png'))
        self.intro5 = pygame.image.load(os.path.join('Graphics_Assets', 'intro5.png'))
        self.ironseed = pygame.image.load(os.path.join('Graphics_Assets', 'main3.png'))
        
        #  Prime intro stage checker
        self.introStage = 0
        self.introFinished = False
        self.musicState = False
        
        #  Prepare counters
        self.count = 1
        self.length = 0
        
        self.encodeStep = 0
        
        self.scavengerStep = 0
        
        self.crashLandingStep = 0

        self.centredX = 0.0
        self.centeredY = 0.0

        #  Prepare Ironseed Intro stopwatch.
        self.stopwatch = h.StopWatch()

        #  Prepare surface used for fading out.
        self.fade = pygame.Surface((g.width,g.height))
        self.fade.fill(g.BLACK)
        self.fade.set_alpha(10)
    
        #  Prepare Channel 7 Logo for blitting.
        self.C7Scaled = pygame.transform.scale(self.channel7Logo, (g.width, g.height))
        self.C7LogoBlit = pygame.PixelArray(self.C7Scaled.convert())
        self.C7LogoCreate = pygame.Surface((g.width, g.height), 0)
        self.C7LogoCreate.set_colorkey(g.BLACK)
        
        #  Prepare starfield for blitting.
        self.starFieldScaled = pygame.transform.scale(self.starField, (g.width, g.height))
        #self.starFieldBlit = pygame.PixelArray(self.scaled.convert())
        
        #  Prepare Mars for Blitting.
        self.marsScaled = pygame.transform.scale(self.mars, (g.width, g.height))
        #self.marsBlit = pygame.PixelArray(self.scaled.convert())
        
        #  Prepare Character communication screen for blitting.
        self.charComScaled = pygame.transform.scale(self.charCom, (g.width, g.height))
        self.charComScaled.set_colorkey(g.BLACK)
        
        # Gradient as a list of tuples.
        self.redBar = h.colourGradient(int(g.width/16)*2, g.RED)
        #  Full length Encode Bar.
        self.fullBar = h.createBar(self.redBar, int((g.width/320)*37), int((g.height/200)*2)+1)
        
        # Red tank light, including flipped version.
        self.redLightScaled = pygame.transform.scale(self.redLight, (int((g.width/320)*13), int((g.height/200)*16)))
        self.redLightScaledFlipped = pygame.transform.flip(self.redLightScaled, True, False)
        
        #  Background star with lens flare.
        self.battleScaled = pygame.transform.scale(self.battle, (g.width, g.height))
        self.battleScaled.set_colorkey(g.BLACK)
        
        #  Prepare ship for blitting, this will be transformed later.
        self.shipScaled = pygame.transform.scale(self.ship, (g.width, g.height))
        self.shipScaled.set_colorkey(g.BLACK)
        
        #  Buffer for image manipulation.
        self.bufferSurfaceImage = pygame.Surface((g.width,g.height))
        self.bufferSurfaceImage.set_colorkey(g.BLACK)
        #  TODO:  Set correct scale ratio.
        
        
        # Prepare Alien battleship deck
        self.alienShipScaled = pygame.transform.scale(self.alienShip, (g.width, g.height))
        self.alienShipScaled.set_colorkey(g.BLACK)
        
        #  Prepare Ironseed deck image;  I really should have the EGO jars
        #  bubbling in distress here.
        self.ironseedScaled = pygame.transform.scale(self.ironseed, (g.width, g.height))
        self.ironseedScaled.set_colorkey(g.BLACK)
        
        #  Create blue status bar for additive overlay.
        self.blueBar = h.colourLine(int((g.width/320)*106), g.BLUE)
        self.fullBlueBar = h.createBar(self.blueBar, int((g.width/320)*106), int((g.height/200)*10)+1)
Exemple #5
0
    def drawInterface(self, displaySurface):

        displaySurface.fill(g.BLACK)
        displaySurface.blit(self.crewInterfaceScaled, (0, 0))

        #  Render heartbeat pulse line in red.
        self.crewPointer.drawStatusLine(displaySurface, self.pulseDisplayArea,
                                        0)

        #  Render small pulse line in red.
        pulse = h.createBar(self.pulseLine, len(self.pulseLine),
                            self.pulseLineArea.height)
        displaySurface.blit(pulse, self.pulseLineArea)

        #  Make pulse rotate right after each frame.
        self.pulseLine = h.shiftArrayRight(self.pulseLine)

        #  Render crewmember image.
        displaySurface.blit(self.crewPointer.resizedImage,
                            ((g.width / 320) * 220, (g.height / 200) * 16))

        #  Render green LED for selected crew member.
        displaySurface.fill(g.GREEN, self.currentGreenLED)

        #  Calculate sanity bar length
        sanityBarLength = int(
            (self.sanityBarArea.height / 100) * self.crewPointer.sanity)

        #  Create sanity bar tuple list.
        sanityBar = h.colourGradient(sanityBarLength, g.RED)

        #  Render sanity bar for selected crew member.
        adjustedSanityBar = h.createBar(sanityBar, sanityBarLength,
                                        self.sanityBarArea.height)
        rotatedSanityBar = pygame.transform.rotate(adjustedSanityBar, -90)
        scaledSanityBar = pygame.transform.scale(
            rotatedSanityBar, (self.sanityBarArea.width, sanityBarLength))
        displaySurface.blit(scaledSanityBar, self.sanityBarArea)

        #  Render pretty graphics in mini-monitor for ambiance.

        displaySurface.blit(self.scaledTitleText[self.titleFrameCount],
                            self.titleTextDraw)

        displaySurface.blit(self.scaledPseudoText[self.pseudoTextCount1],
                            self.pseudoTextDraw1)

        displaySurface.blit(self.scaledPseudoText[self.pseudoTextCount2],
                            self.pseudoTextDraw2)

        #  Adjust frame counters and timers.
        if self.frameCount >= 20:

            self.titleFrameCount += 1

            if self.titleFrameCount >= len(self.scaledTitleText):

                self.titleFrameCount = 0

            self.frameCount = 0

        elif self.frameCount in [0, 5, 10, 15, 20]:

            self.pseudoTextCount1 += 1
            self.pseudoTextCount2 += 1

            if self.pseudoTextCount1 >= len(self.scaledPseudoText):

                self.pseudoTextCount1 = 0

            if self.pseudoTextCount2 >= len(self.scaledPseudoText):

                self.pseudoTextCount2 = 0

        self.frameCount += 1

        #  Clear text area.
        displaySurface.fill(g.BLACK, self.blankDisplayArea)

        #  Render Bio column of text.
        h.renderText(self.crewPointer.bio, g.font, displaySurface, g.WHITE, 15,
                     (g.width / 320) * 6, (g.height / 200) * 131)

        #  Render Character Level text.
        h.renderText([str(self.crewPointer.level)], g.font, displaySurface,
                     g.WHITE, 15, (g.width / 320) * 154,
                     (g.height / 200) * 120)

        #  Render Character Experience points.
        h.renderText([str(self.crewPointer.experience)], g.font,
                     displaySurface, g.WHITE, 15, (g.width / 320) * 190,
                     (g.height / 200) * 120)

        #  Render Character Name.  Note, using 180 for x as is centre of text field.
        h.renderText([str(self.crewPointer.name)], g.font, displaySurface,
                     g.WHITE, 15, (g.width / 320) * 180,
                     (g.height / 200) * 103, True)