Exemple #1
0
    def __init__(self):
        self.CLOSE_GAME = False
        self.width = 1200
        self.height = 800
        self.chunkSize = 735
        self.screen = pygame.display.set_mode([
            self.width,  # x size of the screen
            self.height  # y size of the screen
        ])
        self.currScreen = 'menu'
        self.screens = (
            'menu',
            'game',
        )
        self.brightness = 50  # out of a max of 100

        self.songsFolder = 'Music/'
        self.song = ''
        self.animationFrameTime = 1 / 60
        self.mainMenu = mainMenu.MainMenu(self, self.screen)

        self.emptyGameData = game.GameData
        self.gameDifficulty = 1  # normal difficulty
        # we need to define the gameData only when we have an acceptable file path
        if os.path.isfile(self.song):
            self.gameData = game.GameData(self, self.screen, self.song)
            self.audioThread = self.gameData.musicThread
        else:
            self.gameData = None
Exemple #2
0
    def __init__(self):
        
        self.state = 3  # Initilise with intro set, normally 3.

        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 - Pascal Code Tidying/Prep",
                          "2020 Nuke Bloodaxe - Complete Python Refactor/Rewrite",
                          "All rights reserved."]
        self.versionText = ["Ironseed", g.version]
        
        # Set Window version and Display surface
        print("Initialise Screen.")
        self.displaySurface = pygame.display.set_mode(g.size)
        pygame.display.set_caption(self.versionText[0]+' '+self.versionText[1])
        
        # Initialise game objects
        print("Initilising IronSeed Game Time")
        g.starDate = [2, 3, 3784, 8, 75] # M,D,Y,H,M.
        g.gameDate = h.IronSeedTime()
        
        # Populate Item dictionaries
        print("Loading Items")
        items.loadItemData()
        print("Loading Scan Data")
        planets.loadScanData()
        print("Initialising Planets")
        planets.initialisePlanets()
        print("Loading Planetary Systems")
        planets.loadPlanetarySystems()
        print("Populating Planetary Systems")
        planets.populatePlanetarySystems()
        print("Loading Crew Data")
        crew.loadCrewData()
        print("Initialising Internal Objects:")
        weaponsAndShields.loadWeaponsAndShields()
        print("Crew Objects")
        self.crew = crew.Crew()
        print("Ship Objects")
        self.ship = ship.Ship()
        print("Intro Objects")
        self.intro = intro_main.IronseedIntro()
        print("Game Generator Objects")
        self.generator = gen.Generator(self.ship, self.crew)  # Settings at new-game state.
        print("Commnications System Objects")
        self.crewCom = crewC.crewComm(self.crew)  # Needs to have crew data set.
        print("Planet Scanner Objects")
        self.planetScanner = PlanetScanner.PlanetScanner(self.ship, self.crew)
        print("EGO Synth Manipulation System")
        self.EGOManipulation = EGOSynthManipulator.EGOManipulator(self.crew)
        print("Command Deck System")
        self.commandDeck = commandDeck.CommandDeck(self.ship, self.crew)
        print("Creating Main Menu")
        self.mainMenu = mainMenu.MainMenu()
        
        self.states = {1:self.generator.update,  # The crew + ship selection system.
                       2:self.mainMenu.update,  # Main menu.
                       3:self.intro.update,  # Game Intro - quite useful for testing.
                       4:"cargo",  # Ship cargo system, includes item assembly.
                       5:self.planetScanner.update,  # Planet surveys and drone ops.
                       6:"Communications",  # Comms between ships/planets
                       7:"Combat",  # Normal and simulated combat.
                       8:self.crewCom.update,  # "talk" with crew members.
                       9:self.EGOManipulation.update,  # Ego-synth manipulation.
                       10:self.commandDeck.update,  # Main game command deck.
                       11: "Load Game",
                       12: "Save Game" }
        
        self.interactive = {1:self.generator.interact,
                            2:self.mainMenu.interact,
                            3:self.intro.interact,
                            4:"cargo",
                            5:self.planetScanner.interact,
                            6:"Communications",
                            7:"Combat",
                            8:self.crewCom.interact,
                            9:self.EGOManipulation.interact,
                            10:self.commandDeck.interact,
                            11:"Load Game",
                            12:"Save Game"}
        print("We Are GO!")
Exemple #3
0
                                    stop2 = False
                                    for a in tile.effects:
                                        if a[0] == ability[0]:
                                            stop2 = True
                                    if not stop and ability[0] == k and not stop2 and not abilityCooldown:
                                        abilityCooldown = True
                                        stop = True
                                        ability[1] = ability[2] + 0
                                        tile.effects.append([k,ability[3],False])
                count += 1

        if pressed[0] == 0:
            abilityCooldown = False
                    
        #Drawing range of selected tower
        for j, row in enumerate(Board):
            for i, tile in enumerate(row):
                try:
                    tile = int(tile)
                except Exception:
                    if tile.selected:
                        pygame.draw.circle(gameDisplay, (0, 0, 0, 125), (tile.x+int(tile.width/2), tile.y+int(tile.height/2)),int(tile.range), 2)
        
        pygame.display.flip()
        fpsClock.tick(fps)

    print("Score: " + str(score))

if __name__ == "__main__":
    mainMenu.MainMenu()
Exemple #4
0
 def openApp(self):
     if self.match() != False:
         self.mainApp = ma.MainMenu(self.user)
     else:
         pass #loop back
Exemple #5
0
import pygame, sys
from pygame.locals import *
import buttons, mainMenu

import temporary


pygame.init()

windowSize = (1280, 600) #(1280, 720) Replace later
center_x_window, center_y_window = windowSize[0]/2, windowSize[1]/2 
windowSurface = pygame.display.set_mode(windowSize, 0, 32)
#pygame.FULLSCREEN Replace later

main_menu = mainMenu.MainMenu(windowSurface)

#Mouse presses
LEFT = 1
MIDDLE = 2
RIGHT = 3

#Set up game states, such as main menu, gameplay
game_state = [main_menu]

#Run the game loop
while True:
    
    for event in pygame.event.get():
        #Check if window is closed
        if event.type == QUIT:
            pygame.display.quit()
Exemple #6
0
    def __init__(self):
        
        self.state = 3  # Initilise with intro set, normally 3.

        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 - Pascal Code Tidying/Prep",
                          "2020 Nuke Bloodaxe - Complete Python Refactor/Rewrite",
                          "All rights reserved."]
        self.versionText = ["Ironseed", g.version]
        
        # Set Window version and Display surface
        print("Initialise Screen.")
        self.displaySurface = pygame.display.set_mode(g.size)
        pygame.display.set_caption(self.versionText[0]+' '+self.versionText[1])
        
        # Initialise game objects
        print("Initilising IronSeed Game Time")
        g.starDate = [2, 3, 3784, 8, 75] # M,D,Y,H,M.
        g.gameDate = h.IronSeedTime()
        
        # Populate Item dictionaries
        print("Loading Items: ", end='')
        items.loadItemData()
        print("complete.")
        print("Loading Scan Data: ", end='')
        planets.loadScanData()
        print("complete.")
        print("Initialising Planets: ", end='')
        planets.initialisePlanets()
        print("complete.")
        print("Loading Planetary Systems: ", end='')
        planets.loadPlanetarySystems()
        print("complete.")
        print("Populating Planetary Systems: ", end='')
        planets.populatePlanetarySystems()
        print("complete.")
        print("Loading Crew Data: ", end='')
        crew.loadCrewData()
        print("complete.")
        print("Initialising Internal Objects.")
        print("Weapon and Shield Objects: ", end='')
        weaponsAndShields.loadWeaponsAndShields()
        print("complete.")
        print("Crew Objects: ", end='')
        self.crew = crew.Crew()
        print("complete.")
        print("Ship Objects: ", end='')
        self.ship = ship.Ship()
        print("complete.")
        print("Intro Objects: ", end='')
        self.intro = intro_main.IronseedIntro()
        print("complete.")
        print("Game Generator Objects: ", end='')
        self.generator = gen.Generator(self.ship, self.crew)  # Settings at new-game state.
        print("complete.")
        print("Commnications System Objects: ", end='')
        self.crewCom = crewC.crewComm(self.crew)  # Needs to have crew data set.
        print("complete.")
        print("Planet Scanner Objects: ", end='')
        self.planetScanner = PlanetScanner.PlanetScanner(self.ship, self.crew)
        print("complete.")
        print("EGO Synth Manipulation System: ", end='')
        self.EGOManipulation = EGOSynthManipulator.EGOManipulator(self.crew)
        print("complete.")
        print("Cargo Deck Objects: ", end='')
        self.cargoDeck = cargoDeck.CargoDeck(self.ship)
        print("complete.")
        print("Crew Status Objects: ", end='')
        self.crewStatus = crewStatus.CrewStatus(self.crew)
        print("complete.")
        print("Plant Comms Objects: ", end='')
        self.planetComms = planetComms.PlanetComm(self.ship)
        print("complete.")
        print("Command Deck System: ", end='')
        self.commandDeck = commandDeck.CommandDeck(self.ship, self.crew)
        print("complete.")
        print("Creating Main Menu: ", end='')
        self.mainMenu = mainMenu.MainMenu()
        print("complete.")
        
        # Note:  While in Alpha, the below state list is not exhaustive.
        
        self.states = {1:self.generator.update,  # The crew + ship selection system.
                       2:self.mainMenu.update,  # Main menu.
                       3:self.intro.update,  # Game Intro - quite useful for testing.
                       4:self.cargoDeck.update,  # Ship cargo system - make mistakes fast.
                       5:self.planetScanner.update,  # Planet surveys and drone ops.
                       6:"Ship Hail",  # Comms between ships, with alien character portrait.
                       7:"Combat",  # Normal and simulated combat.
                       8:self.crewCom.update,  # "talk" with crew members.
                       9:self.EGOManipulation.update,  # Ego-synth manipulation.
                       10:self.commandDeck.update,  # Main game command deck.
                       11: "Load Game", # Load Game Screen
                       12: "Save Game", # Save Game Screen (exists?)
                       13: self.crewStatus.update, # Crew character status screen.
                       14: self.planetComms.update, # Ship to planet comms.
                       15: "Ship Logs", # Listing of all log files.
                       16: "Creation",  # really item assembly/disassembly.
                       17: "Sector Map" # Inter-Sector travel.
                       }
        
        self.interactive = {1:self.generator.interact,
                            2:self.mainMenu.interact,
                            3:self.intro.interact,
                            4:self.cargoDeck.interact,
                            5:self.planetScanner.interact,
                            6:"Communications",
                            7:"Combat",
                            8:self.crewCom.interact,
                            9:self.EGOManipulation.interact,
                            10:self.commandDeck.interact,
                            11:"Load Game",
                            12:"Save Game",
                            13: self.crewStatus.interact,
                            14: self.planetComms.interact,
                            15: "Ship Logs",
                            16: "Creation",
                            17: "Sector Map"
                            }
        print("We Are GO!")
Exemple #7
0
 def showMainMenu(self):
     self.close()
     print("showMainMenu")
     import mainMenu as mM
     self.mainM = mM.MainMenu()
     self.mainM.show()
Exemple #8
0
 def goBackToMainMenu(self):
     import mainMenu
     mainMenu.MainMenu()
     self.root.destroy()