Пример #1
0
    def update(self):
        if self.serpent.stats.hp == 0 and not self.buildbrige:
            sound.playMusic("music/Existing.s3m")
            sound.achievement.Play()
            system.engine.addCaptions(Caption('Serpent defeated!'))
            savedata['finalbattledone'] = 'True'
            self.buildbrige = True
            self.time = 100  #wait 1 second before starting to build the bridge

        if self.buildbrige:
            if self.time == 0:
                self.time = 20
                l = ika.Map.FindLayerByName('B1.5')
                if self.row == 27:
                    ol = ika.Map.FindLayerByName('B2')
                    for y in range(27, 18, -1):  #haaaack
                        if y == 19 or y == 27:
                            obs = [0, 0, 0, 0, 0]
                        else:
                            obs = [1, 0, 0, 0, 1]
                        for x, o in enumerate(obs):
                            ika.Map.SetObs(x + 21, y, ol, o)

                for x in range(5):
                    ika.Map.SetTile(x + 21, self.row, l,
                                    icebridge[self.row][x])
                    if self.row > 19:
                        ika.Map.SetTile(x + 21, self.row - 1, l, temp[x])
                self.row -= 1
                if self.row < 19:
                    return True  #done
            else:
                self.time -= 1
Пример #2
0
 def update(self):
     if 'nearend' in savedata.__dict__ and 'waterguard' not in savedata.__dict__:
         sound.playMusic("music/resurrection.it")
         y = SoulReaver(ika.Entity(15* 16, 17 * 16, system.engine.player.layer, 'soulreaver.ika-sprite'))
         system.engine.addEntity(y)
         system.engine.mapThings.append(DeathListener2(y))
         return True
Пример #3
0
 def update(self):
     if self.yeti.stats.hp == 0:
         sound.playMusic("music/winter.ogg")
         e = ika.Entity(5 * 16, 8 * 16, 2, 'firerune.ika-sprite')
         e.name = 'firerune'
         system.engine.addEntity(FireRune(e))
         return True
Пример #4
0
 def update(self):
     sound.playMusic('music/resurrection.it')
     y = SoulReaver(ika.Entity(21 * 16, 13 * 16, 3,
                               'soulreaver.ika-sprite'))
     system.engine.addEntity(y)
     system.engine.mapThings.append(DeathListener2(y))
     return True
Пример #5
0
 def update(self):
     if 'nearend' in savedata.__dict__:
         sound.playMusic('music/resurrection.it')
         y = SoulReaver(
             ika.Entity(19 * 16, 20 * 16, 2, 'soulreaver.ika-sprite'))
         system.engine.addEntity(y)
         system.engine.mapThings.append(DeathListener(y))
         return True
Пример #6
0
 def update(self):
     if self.yeti.stats.hp == 0:
         e = ika.Entity(315, 320, 2, 'unityrune.ika-sprite')
         e.name = 'unityrune'
         system.engine.addEntity(UnityRune(e))
         sound.playMusic("music/lampoons.it")
         savedata.finalrune = 'True'
         system.engine.addCaptions(Caption('Rune Guardian defeated.'))
         return True
Пример #7
0
def AutoExec():
    system.engine.mapThings.append(Snow(6000, velocity=(-.2, 3)))
    if 'waterrune' not in savedata.__dict__:
        system.engine.things.append(RuneListener())
    if 'nearend' in savedata.__dict__:
        system.engine.things.append(RuneListener())
    if 'icechunks1' in savedata.__dict__:
        breakIceRun()
    sound.playMusic("music/wind.ogg")
Пример #8
0
	def __init__(self):
		self.data = Data()
		self.data.screen.fill(self.data.grey)
		pygame.display.set_caption('London\'s Burning!')

		pygame.mouse.set_cursor(*pygame.cursors.diamond)

		self.mainMenu = MainMenu(self.data)
		self.gameHandler = None

		sound.playMusic('assets/sounds/searching.mp3')   # courtesy of http://ericskiff.com/music/
Пример #9
0
def fightBoss():
    if 'bossin10' not in savedata.__dict__:
        savedata.bossin10 = 'True'
        y = Yeti(
            ika.Entity(158, 352, system.engine.player.layer,
                       'yeti.ika-sprite'))
        system.engine.addEntity(y)
        system.engine.mapThings.append(DeathListener(y))
        sound.playMusic("music/competative.xm")
        sound.yetiDie[0].Play()
        AddIce()
Пример #10
0
   def transferTo(self, mMap, position):
      del(self.map.sprites["PLAYER"])
      self.map.connectedMaps = {}
      
      self.map = mMap
      self.position = position

      self.map.sprites["PLAYER"] = self
      self.map.loadConnections()

      sound.playMusic(self.map.music)
Пример #11
0
 def update(self):
     done = True
     for e in self.enemies:
         if e.stats.hp > 0:
             done = False
     if done: #all are dead
         sound.playMusic("music/wind.ogg")
         e = ika.Entity(15*16, 16*16, 4, 'waterrune.ika-sprite')
         e.name = 'waterrune'
         system.engine.addEntity(WaterRune(e))          
         
         return True
Пример #12
0
    def __init__(self):
        self.data = Data()
        self.data.screen.fill(self.data.grey)
        pygame.display.set_caption('London\'s Burning!')

        pygame.mouse.set_cursor(*pygame.cursors.diamond)

        self.mainMenu = MainMenu(self.data)
        self.gameHandler = None

        sound.playMusic('assets/sounds/searching.mp3'
                        )  # courtesy of http://ericskiff.com/music/
Пример #13
0
def intro():
    sound.playMusic('music/Wind.ogg')
    wait(75)
    speech(grandpa, "It's getting to be quite the blizzard out there...")
    wait(75)
    animate(kid1, (0, 1),
            delay=20,
            text='Oh no! I hope daddy will be able to get back here?')
    speech(
        grandpa,
        "Oh, he'll be fine. We grew up in these mountains, this is nothing for him."
    )
    animate(kid1, (0, 1), delay=20, text="Ok, if you're sure!")
    wait(75)
    speech(grandpa, "While we wait, why don't I tell you a story?")
    animate(kid3, (0, 1), delay=20, text='Yeah! Tell us a story!')
    animate(kid2, (1, ), delay=20, text='How about the one about the ice man?')
    animate(kid1, (0, 1), delay=20, text="Yeah!")
    speech(grandpa, "Isn't that story a little scary?")
    animate(kid1, (0, 1), delay=20, text='No!')
    animate(kid2, (0, 1), delay=20, text='Please tell us!')
    speech(grandpa, 'Oh all right.  Ahem.')
    animate(kid3, (0, 1), delay=20, text="I'm a little scared...")
    tint.tint = 200
    narration(
        """Across the frozen hills of the province of Kuladriat, a simple man was returning home from a long journey. Even dressed in his warmest cloak, he could feel the stinging wind chilling him right down to his bones."""
    )
    narration(
        """Undaunted, he travelled ever-northward, the wintery air freezing in his throat. He needed only to traverse the treacherous Mount Durinar, his small village awaiting him on the other side."""
    )
    narration(
        """Though the bridges and roads built upon the mountain's cliffs had long since been abandoned to time, there were still stories told of lost magic, hidden somewhere within those frigid peaks."""
    )
    narration(
        """As he climbed, the thoughts of enjoying a warm fire and hearty meal filled his head. But he was shocked out of his daydreams when suddenly..."""
    )
    animate(kid3, (0, 1), delay=20, text="Oh no!!")
    narration(
        """The howls of a Razormane pack at the top of a steep hill startled him, and just as abruptly they began to give chase, moving swiftly and easily through the snow."""
    )
    narration(
        """His breaths came in chilled, raspy gasps as he ran. Even with his sword in hand, he knew he would be no match against the ravenous beasts."""
    )
    narration(
        """Before long, the pack pursued him right to the edge of a cliff. He turned to face his predators, but his boots lost their grip on the ice and he slipped."""
    )
    narration(
        """With an echoing scream, he fell, the sounds of stones crashing around him as he tumbled down into a ravine."""
    )
    tint.tint = 0
    narration(
        """The Razormanes did not follow. The cliff face was far too steep to climb back up, and so they seemingly left him to his fate..."""
    )
Пример #14
0
    def update(self):
        if self.yeti.stats.hp == 0:
            if 'windrune' not in savedata.__dict__:
                e = ika.Entity(304, 304, 2, 'windrune.ika-sprite')
                e.name = 'windrune'
                system.engine.addEntity(WindRune(e))
            else:
                setattr(savedata, 'windguard', 'True')
                system.engine.addCaptions(Caption('Rune Guardian defeated.'))

            sound.playMusic('music/winter.ogg')
            return True
Пример #15
0
def mapSwitch(newMapName, dest=None, fade=True):
    global mapName, mapModule, mapThings, bgThings, fields

    fade = False # temp

    if fade:
        draw()
        screen = effects.grabScreen()

    mapName = newMapName

    # all maps load from MAP_PATH
    mapName = '%s/%s' % (config.MAP_PATH, mapName)
    background = None
    mapThings = []
    bgThings = []
    fields = []
    ika.Map.entities.clear()

    # drop the extension, convert slashes to dots, and prepend the maps
    # package ie 'blah/map42.ika-map' becomes 'maps.blah.map42'
    moduleName = mapName[:mapName.rfind('.')].replace('/', '.')
    mapModule = __import__(moduleName, {}, {}, [''])

    ika.Map.Switch(mapName)
    metaData = ika.Map.GetMetaData()
    readZones(mapModule)
    readEnts(mapModule)

    if player:
        player.state = player.defaultState()

    if dest and player:
        if len(dest) == 2:
            player.x, player.y = dest
            player.layer = ika.Map.FindLayerByName(metaData['entityLayer'])
        elif len(dest) == 3:
            player.x, player.y, player.layer = dest
        else:
            raise Exception

        camera.center()

    if 'music' in metaData:        
        sound.playMusic(metaData['music'])

    if fade:
       draw()
       effects.crossFade(50, screen)

    synchTime()
Пример #16
0
def spawnpack():
    if 'waterrune' not in savedata.__dict__ and 'pack' not in savedata.__dict__:      
        savedata.pack = 'True' 
        e = [
        RazorMane(ika.Entity(15* 16, 29 * 16, system.engine.player.layer, 'razormane.ika-sprite')),
        RazorMane(ika.Entity(11* 16, 31 * 16, system.engine.player.layer, 'razormane.ika-sprite')),
        RazorMane(ika.Entity(14* 16, 7 * 16, system.engine.player.layer, 'razormane.ika-sprite')),
        RazorMane(ika.Entity(16* 16, 8 * 16, system.engine.player.layer, 'razormane.ika-sprite')),
        RazorMane(ika.Entity(19* 16, 29 * 16, system.engine.player.layer, 'razormane.ika-sprite'))
        ]
        for en in e:
            system.engine.addEntity(en)                
        system.engine.mapThings.append(DeathListener(e))
        sound.playMusic("music/competative.xm")    
        sound.razorManeStrike.Play()
Пример #17
0
   def walk(self, direction, force=False, isPlayer=True):
      sprite.Sprite.walk(self, direction, force, True)

      if (self.destination[0] < 0) and self.busy:
            hold = self.map
            con = self.map.connectedMaps[sprite.DIR_LEFT][0]
            offset = self.map.connectedMaps[sprite.DIR_LEFT][1]
            self.position = self.position[0]+con.size[0], self.position[1]-offset
            self.destination = self.position[0]-1, self.position[1]
            self.map = con
            hold.connectedMaps = {}
            self.map.loadConnections()
            self.map.connectedMaps[sprite.DIR_RIGHT] = (hold, -1*offset)
            del(hold.sprites["PLAYER"])
            self.map.sprites["PLAYER"] = self
            sound.playMusic(self.map.music)
      elif (self.destination[0] >= self.map.size[0]) and self.busy:
            hold = self.map
            con = self.map.connectedMaps[sprite.DIR_RIGHT][0]
            offset = self.map.connectedMaps[sprite.DIR_RIGHT][1]
            self.position = self.position[0]-self.map.size[0], self.position[1]-offset
            self.destination = self.position[0]+1, self.position[1]
            self.map = con
            hold.connectedMaps = {}
            self.map.loadConnections()
            self.map.connectedMaps[sprite.DIR_LEFT] = (hold, -1*offset)
            del(hold.sprites["PLAYER"])
            self.map.sprites["PLAYER"] = self
            sound.playMusic(self.map.music)
      elif (self.destination[1] < 0) and self.busy:
            hold = self.map
            con = self.map.connectedMaps[sprite.DIR_UP][0]
            offset = self.map.connectedMaps[sprite.DIR_UP][1]
            self.position = self.position[0]-offset, self.position[1]+con.size[1]
            self.destination = self.position[0], self.position[1]-1
            self.map = con
            hold.connectedMaps = {}
            self.map.loadConnections()
            self.map.connectedMaps[sprite.DIR_DOWN] = (hold, -1*offset)
            del(hold.sprites["PLAYER"])
            self.map.sprites["PLAYER"] = self
            sound.playMusic(self.map.music)
      elif (self.destination[1] >= self.map.size[1]) and self.busy:
            hold = self.map
            con = self.map.connectedMaps[sprite.DIR_DOWN][0]
            offset = self.map.connectedMaps[sprite.DIR_DOWN][1]
            self.position = self.position[0]-offset, self.position[1]-self.map.size[1]
            self.destination = self.position[0], self.position[1]+1
            self.map = con
            hold.connectedMaps = {}
            self.map.loadConnections()
            self.map.connectedMaps[sprite.DIR_UP] = (hold, -1*offset)
            del(hold.sprites["PLAYER"])
            self.map.sprites["PLAYER"] = self
            sound.playMusic(self.map.music)
Пример #18
0
    def __init__(self, screen, savegame=None):
        """
      Open the save file (or make a new one) and create camera and script engine.

      screen - the screen to render to.
      sound - the sound manager.
      savegame - path to the save file to open, or None to start a new game.
      """

        #store variables for use later
        self.screen = screen

        #parse the game XML file
        fn = os.path.join(settings.path, "data", "game.xml")
        root = data.getTreeRoot(fn, "Ditto main")
        for p in data.getChildren(root, "property"):
            if data.getAttr(p, "name", data.D_STRING) == "menu":
                self.menuPath = data.getAttr(p, "value", data.D_STRING)

        #create script engine and initialise variables
        self.scriptEngine = script_engine.ScriptEngine()
        self.scriptEngine.setup(self)
        self.paused = False
        self.foregroundObject = None

        #if there's a save, open it
        #else start a new game
        if savegame is not None:
            self.openSave(savegame, root)
        else:
            self.newGame(os.path.join(settings.path, "saves", "ditto.sav"),
                         root)

        #put the player onto the map and play music
        self.map.sprites["PLAYER"] = self.player
        sound.playMusic(self.player.map.music)

        #create a camera and attach to the player
        self.camera = camera.Camera(screen)
        self.camera.attachTo(self.player)
Пример #19
0
    def __init__(self, screen, savegame=None):
        """
      Open the save file (or make a new one) and create camera and script engine.

      screen - the screen to render to.
      sound - the sound manager.
      savegame - path to the save file to open, or None to start a new game.
      """

        # store variables for use later
        self.screen = screen

        # parse the game XML file
        fn = os.path.join(settings.path, "data", "game.xml")
        root = data.getTreeRoot(fn, "Ditto main")
        for p in data.getChildren(root, "property"):
            if data.getAttr(p, "name", data.D_STRING) == "menu":
                self.menuPath = data.getAttr(p, "value", data.D_STRING)

        # create script engine and initialise variables
        self.scriptEngine = script_engine.ScriptEngine()
        self.scriptEngine.setup(self)
        self.paused = False
        self.foregroundObject = None

        # if there's a save, open it
        # else start a new game
        if savegame is not None:
            self.openSave(savegame, root)
        else:
            self.newGame(os.path.join(settings.path, "saves", "ditto.sav"), root)

        # put the player onto the map and play music
        self.map.sprites["PLAYER"] = self.player
        sound.playMusic(self.player.map.music)

        # create a camera and attach to the player
        self.camera = camera.Camera(screen)
        self.camera.attachTo(self.player)
Пример #20
0
def kaboom():
    #nearend quest completed!
    if 'penultimatebattle' not in savedata.__dict__ and 'waterguard' in savedata.__dict__ and 'windguard' in savedata.__dict__ and 'fireguard' in savedata.__dict__:
        savedata.penultimatebattle = 'True'
        p = system.engine.player

        def noOp():
            while True:
                yield None

        p.anim = 'stand'
        p.state = noOp()
        sound.playMusic('music/resurrection.it')
        for n in range(150):
            # teh earthquake
            ika.Map.xwin += ika.Random(-3, 3)
            ika.Map.ywin += ika.Random(-3, 3)
            system.engine.tick()
            system.engine.draw()
            ika.Video.ShowPage()
            ika.Input.Update()

        e = ika.Entity(48 * 16 - 8, 9 * 16, 2, 'crystal.ika-sprite')
        e.name = 'penultimatecrystal'
        system.engine.addEntity(Crystal(e))

        y = SoulReaver(ika.Entity(20 * 16, 20 * 16, 2,
                                  'soulreaver.ika-sprite'))
        y.stats.maxhp += 150
        y.stats.hp += 150
        y.stats.att += 6
        y.stats.exp += 150
        system.engine.addEntity(y)
        system.engine.mapThings.append(DeathListener(y))

        p.state = p.defaultState()
        system.engine.synchTime()
Пример #21
0
 def update(self):
     if self.yeti.stats.hp == 0:
         sound.playMusic("music/wind.ogg")
         savedata.waterguard = 'True'
         system.engine.addCaptions(Caption('Rune Guardian defeated.'))
         return True
Пример #22
0
import subscreen
subscreen.init()

try:
    c = controls.readConfig(config.CONTROL_CONFIG)
except IOError:
    c = controls.defaultControls
    controls.writeConfig(config.CONTROL_CONFIG, c)

#c = controls.defaultControls
controls.setConfig(c)

import data
data.init()

sound.playMusic('title')

# LEAVE THIS FOR LATER K
#for n in range(1,100):
#    print '%i: %i' % (n, int(50 * (1.9 ** (n - 1))))

intro()

while True:

    #sound.fader.kill()
    #introMusic.position = 0
    #introMusic.Play()

    #need to move to appropriate place
Пример #23
0
   def onShow(self):
      """Called when the screen is actually shown for the first time."""

      #if there is any music to play, play it                             
      if self.music is not None:
         sound.playMusic(self.music)
Пример #24
0
    def onShow(self):
        """Called when the screen is actually shown for the first time."""

        #if there is any music to play, play it
        if self.music is not None:
            sound.playMusic(self.music)
Пример #25
0
def AutoExec():
    system.engine.mapThings.append(Snow(5000, velocity=(-1.2, 3)))
    sound.playMusic("music/wind.ogg")
Пример #26
0
def bridge_break():
    if 'bridge_broken' not in savedata.__dict__:

        sound.playMusic('music/Competative.xm')

        savedata.bridge_broken = 'True'

        bridge = ((366, 0, 367), (372, 0, 373), (378, 0, 379))

        for x in range(3):
            ika.Map.SetTile(x + 19, 28, 4, bridge[0][x])
            ika.Map.SetTile(x + 19, 29, 4, bridge[1][x])
            ika.Map.SetTile(x + 19, 30, 4, bridge[2][x])
            ika.Map.entities['break_gap'].x = 320

        # This is really cheap.  Probably fragile too.  I'm stepping beyond
        # the game engine and directly twiddling with ika.

        engine = system.engine
        p = engine.player
        p.stop()
        p.layer = 3
        p.ent.specframe = 91
        p._state = lambda: None  # keep the player from moving

        engine.draw()
        ika.Video.ShowPage()
        ika.Delay(8)

        for y in range(32):
            p.y += 1
            #ika.ProcessEntities()
            engine.camera.update()
            engine.draw()
            ika.Video.ShowPage()
            ika.Delay(1)

        p.layer = 2

        for y in range(32):
            p.y += 1
            #ika.ProcessEntities()
            engine.camera.update()
            engine.draw()
            ika.Video.ShowPage()
            ika.Delay(1)

        p.ent.specframe = 92
        t = ika.GetTime() + 80
        while t > ika.GetTime():
            engine.draw()
            ika.Video.ShowPage()
            #ika.Input.Update()

        p.state = p.standState()

        y = Yeti(ika.Entity(304, 64, 2, 'yeti.ika-sprite'))
        # UBER-YETI
        y.stats.maxhp = 400
        y.stats.hp = y.stats.maxhp
        y.stats.att += 10
        engine.addEntity(y)
        engine.mapThings.append(DeathListener(y))

        engine.synchTime()
Пример #27
0
def friedrich():
    fried = engine.entFromEnt[ika.Map.entities['friedrich']]

    if 'rescued' not in engine.saveData:
        engine.saveData['rescued'] = True

        ana = engine.player.ent
        engine.beginCutScene()

        sound.playMusic('storyscene')
        text(fried, "friedrich2", "Ana!  Thank goodness!")
        text(ana, "anastasia3", "What happened to you?")
        fried.specframe = 5
        text(
            fried, "friedrich",
            "Remember the item I told you about earlier? One of the little buggers took it! "
        )
        fried.specframe = 4
        text(
            fried, "friedrich",
            " I thought nothing of chasing down a young goblin...but then he came in here."
        )
        text(ana, "anastasia", "A cave full of goblins!")
        text(
            fried, "friedrich2",
            "Yes...how they built a home this close to town without anyone noticing still eludes me."
        )
        text(fried, "friedrich",
             "But it wasn't all bad. We have the item back. Look!")
        fried.specframe = 1
        text(ana, "anastasia", "What is that? It's...")
        text(fried, "friedrich", "Yes..")
        text(ana, "anastasia2", "...just a rock!")

        fried.specframe = 7
        text(fried, "friedrich2",
             "Just a rock??  Do you have any idea how old it is?")
        text(ana, "anastasia", "A thousand years?")
        text(
            fried, "friedrich2",
            "ONLY A THOUSA...oh...well, you're right, actually.  It is precisely 998 years old."
        )
        text(ana, "anastasia2", "How do you know?")
        fried.specframe = 4
        text(
            fried, "friedrich",
            "Because it belongs to the Kojima...a race of people who once populated this very island. "
        )
        text(fried, "friedrich",
             "They were wiped out by a natural disaster ages ago.")

        text(
            fried, "friedrich",
            "It's amazing, really.  This is perhaps the oldest Kojima artifact ever found!"
        )

        text(ana, "anastasia2",
             "Ooooh!  So that means this is really, really important!")
        fried.specframe = 7
        text(fried, "friedrich2", "YES!!!")
        text(ana, "anastasia", " Wow, Fred...this could make you filthy rich!")
        fried.specframe = 4
        text(
            fried, "friedrich",
            "Let's not get ahead of ourselves.  I still have many authenticity tests to run.  "
        )
        text(fried, "friedrich",
             "You never know who might be out to prank us.")
        text(ana, "anastasia3",
             "Don't worry...if anybody tries that I'll kick their butts!")

        engine.things.append(Quake(20))
        t = ika.GetTime()
        while ika.GetTime() < t + 10:
            delay(1)

        text(ana, "anastasia2", "What the...")
        text(fried, "friedrich", "Hmm?")
        text(ana, "anastasia2", "Didn't you feel the ground shaking??")
        text(fried, "friedrich",
             "Well, as you can tell, I don't do a lot of standing around...")

        engine.things.append(Quake(100, x=4, y=4))
        t = ika.GetTime()
        while ika.GetTime() < t + 200:
            delay(1)
        fried.specframe = 6
        text(fried, "friedrich2", "Sweet Candy!  What was THAT?")
        text(ana, "anastasia2", "Look! The artifact is glowing!")

        fried.specframe = 4
        text(fried, "friedrich", "Hmm...")
        text(ana, "anastasia", "What do you think it could mean?")
        text(fried, "friedrich", ".It seems that...hmm...")
        text(fried, "friedrich2",
             "...that the shaking and the glowing MUST be related!")
        text(
            ana, "anastasia3",
            "JESUS, Fred!  Even I could've figured that one out!  You know, you're not as smart as you look."
        )
        text(fried, "friedrich",
             "Hmph!  I...honestly have no idea what it could be!")
        text(ana, "anastasia3", "Arg!!")
        fried.specframe = 5
        text(fried, "friedrich2", "Unless... there could be one posibility. ")
        text(
            fried, "friedrich",
            "But...of course it is all a Kojima legend.  But it couldn't possibly..."
        )
        text(ana, "anastasia", "What's the legend?")
        text(
            fried, "friedrich",
            'Well...it is believed that the natural disaster that caused the Kojima to vanish was this very thing. '
        )
        text(fried, "friedrich", 'It was called an "earthquake."')

        text(ana, "anastasia", "Earthquake?")
        text(
            fried, "friedrich",
            "Yes.  But it's all impossible of course.  Earthquakes are a myth."
        )

        fried.specframe = 6
        engine.things.append(Quake(100, x=2, y=2))
        t = ika.GetTime()
        while ika.GetTime() < t + 100:
            delay(1)

        text(ana, "anastasia3", "That feel like a myth to you?!?")
        text(fried, "friedrich2", "Aaaagh!")
        text(
            ana, "anastasia2",
            "Wait...I think it's trying to tell me something.  These arrows...what are they?"
        )
        fried.specframe = 4
        text(
            fried, "friedrich",
            "They look like directions!  Everytime the stone lights up it's pointing you in a direction."
        )
        text(ana, "anastasia", "It's pointing...west! What's to the west?")
        text(fried, "friedrich", "I don't know...maybe you should see!")
        text(
            ana, "anastasia3",
            "Me?  You're the one with wings, buster!  Why do I have to run my ass off?"
        )
        text(
            fried, "friedrich2",
            "Dear, Anastasia.  I can't carry that heavy artifact in my talons!  It would be suicide!"
        )
        text(
            ana, "anastasia3",
            "Oh I get it...you're still scared of the tiny little itsy-bitsy goblins."
        )
        text(
            fried, "friedrich",
            "No!  I just...don't want to drop it is all.  Now, head west, Ana!"
        )
        text(ana, "anastasia", "Right!")
        text(fried, "friedrich", "Good luck!")
        text(ana, "anastasia3", "...What a wimp")
        engine.endCutScene()
        sound.playMusic('dungeon')
    else:
        text(fried, "friedrich", "Good luck!")
Пример #28
0
 def tick(self):
    if self.waiting: #if waiting
       if self.waitingFor is not None: #if we're waiting for an object
          if not self.waitingFor.busy: #if what we're waiting for is no longer busy
             self.waiting = False #stop waiting
             self.waitingFor = None #no longer waiting for anything
       else: #else
          self.countdown -= 1 #decrease the countdown
          if self.countdown <= 0: #if we've finished counting down
             self.waiting = False #stop waiting
    
    while (not self.waiting and self.running): #while we're not waiting and still have commands to process
       cmd = self.script.commands[self.currentCommand] #get the current command
       if cmd[0] == CMD_LOCK: #if it's LOCK
          print "LOCK"
          self.game.player.lock() #lock the player
          if self.caller.__class__.__name__ == "NPC": #if the script has a caller
             self.caller.lock() #lock it
       elif cmd[0] == CMD_UNLOCK: #if it's UNLOCK
          print "UNLOCK"
          self.game.player.unlock() #unlock the player
          if self.caller.__class__.__name__ == "NPC": #if the script has a caller
             self.caller.unlock() #unlock it
       elif cmd[0] == CMD_FACEPLAYER: #if it's FACEPLAYER
          print "FACEPLAYER"
          difference = self.game.player.position[0]-self.caller.position[0], self.game.player.position[1]-self.caller.position[1] #calculate offset between player and caller
          if difference == (0, -1): #if player is above caller
             self.caller.direction = sprite.DIR_UP #face UP
          elif difference == (0, 1): #if player is below caller
             self.caller.direction = sprite.DIR_DOWN #face DOWN
          elif difference == (-1, 0): #if player is to left of caller
             self.caller.direction = sprite.DIR_LEFT #face LEFT
          elif difference == (1, 0): #if player is to right of caller
             self.caller.direction = sprite.DIR_RIGHT #face RIGHT        
       elif cmd[0] == CMD_WAIT: #if it's WAIT
          print "WAIT"
          self.waiting = True #we're waiting
          self.waitingFor = None #not waiting for an object
          self.countdown = cmd[1] #set countdown as needed
       elif cmd[0] == CMD_MOVEME: #if it's MOVEME
          print "MOVEME"
          self.caller.walkUp(cmd[1], True) #walk, force move
          self.waiting = True #we're waiting
          self.waitingFor = self.caller #waiting for caller       
       elif cmd[0] == CMD_DIALOG: #if it's DIALOG
          print "DIALOG"
          text = map(self.resolveString, cmd[1]) #resolve the text strings for variables
          d = dialog.Dialog(text, self.font, self.game.screen, cmd[2]) #create the dialog
          self.game.foregroundObject = d #set it as the game's active object
          self.waiting = True #we're waiting
          self.waitingFor = d #waiting for the dialog
       elif cmd[0] == CMD_SETVAR:
          print "SETVAR"
          if cmd[1][0] == "$":
             self.variables[cmd[1][1:-1]] = cmd[2]
          elif cmd[1][0] == "*":
             self.game.savegame.variables[cmd[1][1:-1]] = cmd[2]
       elif cmd[0] == CMD_GETVAR:
          print "GETVAR"
          self.result = self.variables[cmd[1]]
       elif cmd[0] == CMD_COMPARE: #if it's COMPARE
          print "COMPARE"
          self.result = (self.resolveString(cmd[1]) == self.resolveString(cmd[2])) #store whether the two are equal
       elif cmd[0] == CMD_GOTO: #if it's GOTO
          print "GOTO"
          self.currentCommand = cmd[1]-1 #go to the line before the one required, which will then be advanced to the correct line
       elif cmd[0] == CMD_IFFALSEGOTO: #if it's IFFALSEGOTO
          print "IFFALSEGOTO"
          if not self.result: #if comparison result is False
             self.currentCommand = cmd[1]-1 #goto to the line before the one required, which will then be advanced to the correct line
       elif cmd[0] == CMD_MOVEPLAYER: #if it's MOVEPLAYER
          print "MOVEPLAYER"
          self.game.player.walk(cmd[1], True) #move the player
          self.waiting = True #we're waiting
          self.waitingFor = self.game.player #we're waiting for the player
       elif cmd[0] == CMD_CHOICEDIALOG: #if it's CHOICEDIALOG
          print "CHOICEDIALOG"
          text = map(self.resolveString, cmd[1]) #resolve the text for variables
          d = dialog.ChoiceDialog(text, self.font, self.game.screen, self, cmd[2]) #create the choice dialog
          self.game.foregroundObject = d #set it as the game's active object
          self.waiting = True #we're waiting
          self.waitingFor = d #waiting for the choice dialog
       elif cmd[0] == CMD_SHOWSPRITE: #if it's SHOWSPRITE
          print "SHOWSPRITE"
          if self.caller is not None: #if there's a caller
             if self.caller.__class__.__name__ == "Tilemap": #if it was a map
                self.caller.getSpriteById(cmd[1]).visible = True #set the sprite visible
             elif self.caller.__class__.__name__ == "NPC": #if it was an NPC
                self.caller.map.getSpriteById(cmd[1]).visible = True #set the sprite visible
          else: #else
             self.game.player.map.getSpriteById(cmd[1]).visible = True #set the sprite visible
       elif cmd[0] == CMD_HIDESPRITE: #if it's HIDESPRITE
          print "HIDESPRITE"
          if self.caller is not None: #if there's a caller
             if self.caller.__class__.__name__ == "Tilemap": #if it was a map
                self.caller.getSpriteById(cmd[1]).visible = False #set the sprite invisible
             elif self.caller.__class__.__name__ == "NPC": #if it was an NPC
                self.caller.map.getSpriteById(cmd[1]).visible = False #set the sprite invisible
          else: #else
             self.game.player.map.getSpriteById(cmd[1]).visible = False #set the sprite invisible
       elif cmd[0] == CMD_WARP:
          print "WARP"
          if False:
             p = self.game.player
             del(p.map.sprites["PLAYER"])
             p.map = tilemap.Tilemap(cmd[1], self)
             p.map.loadConnections()
             p.position = cmd[2]
             p.destination = cmd[2]
             p.level = cmd[3]
             p.map.sprites["PLAYER"] = p
             sound.playMusic(p.map.music)
          else:
             p = self.game.player
             mMap = tilemap.Tilemap(cmd[1], self)
             p.transferTo(mMap, cmd[2])
             p.destination = p.getPositionInFront()
             p.level = cmd[3]
       elif cmd[0] == CMD_FADEOUTANDIN:
          print "FADEOUTANDIN"
          self.game.foregroundObject = foreground_object.FadeOutAndIn(self.game.screen, cmd[1])
       elif cmd[0] == CMD_GIVEPOKEMON:
          print "GIVEPOKEMON"
          poke = pokemon.Pokemon(cmd[1], cmd[2])
          self.game.player.party.add(poke)
       elif cmd[0] == CMD_SURF:
          print "SURF"
          self.game.player.surf()
          
       self.currentCommand += 1 #advance to next command
       if self.currentCommand >= len(self.script.commands): #if we've reached the end of the script
          if len(self.queue) == 0:
             self.running = False #no longer running
          else:
             print "Script from queue"
             s, caller = self.queue.pop()
             self.running = True #running a script
             self.script = s #store the script
             self.caller = caller #store the caller of the script
             self.currentCommand = 0 #reset command counter to start
             self.waiting = False #not yet waiting
             self.waitingFor = None #not waiting for anything
          break #stop processing
Пример #29
0
    def mapSwitch(self,
                  mapName,
                  dest=None,
                  fade=True,
                  newgame=False,
                  fadeout=True):
        startImages = effects.createBlurImages()
        if fade and fadeout:
            self.draw()

        self.mapName = mapName

        # all maps load from the maps/ subdirectory
        mapName = 'maps/' + mapName
        self.background = None
        self.mapThings = []
        self.fields = []
        ika.Map.entities.clear()

        # drop the extension, convert slashes to dots, and prepend the maps package
        # ie 'blah/map42.ika-map' becomes 'maps.blah.map42'
        moduleName = mapName[:mapName.rfind('.')].replace('/', '.')
        mapModule = __import__(moduleName, globals(), locals(), [''])
        ika.Map.Switch(mapName)
        metaData = ika.Map.GetMetaData()

        if self.player:
            self.killList = self.entities[:]
            self.killList.remove(self.player)
            self.clearKillQueue()

        self.readZones(mapModule)

        self.readEnts(mapModule)

        if self.player:
            self.player.state = self.player.defaultState()
        if dest and self.player:
            if len(dest) == 2:
                self.player.x, self.player.y = dest
                lay = metaData['entityLayer']
                self.player.layer = ika.Map.FindLayerByName(lay)
            elif len(dest) == 3:
                self.player.x, self.player.y, self.player.layer = dest
            else:
                assert False

            self.camera.center()

        automap.map.update()
        if automap.map.maptype == 'cave':
            self.mapThings.append(Darkglow())

        if 'music' in metaData:
            sound.playMusic('music/' + metaData['music'])

        if fade:
            self.draw()
            endImages = effects.createBlurImages()
            effects.blurFade(50, startImages, endImages)

        self.synchTime()
Пример #30
0
            print('Minus Button pressed')
            move.turnCounter(speed)
            time.sleep(button_delay)

        if (buttons & cwiid.BTN_A):
            print('Button A pressed')
            move.domeClockwise(headSpeed)
            time.sleep(button_delay)

        if (buttons & cwiid.BTN_B):
            print('Button B pressed')
            move.domeCounter(headSpeed)
            time.sleep(button_delay)

        if (buttons & cwiid.BTN_1):
            playMusic('YES')
            send_to_arduino(HAPPY)
            print "HELLO"
            time.sleep(5 * button_delay)
            while (buttons):
                buttons = wii.state['buttons']
            continue

        if (buttons & cwiid.BTN_2):
            playMusic('NO')
            send_to_arduino(DANGER)
            time.sleep(5 * button_delay)
            while (buttons):
                buttons = wii.state['buttons']
            continue
Пример #31
0
    def tick(self):
        if self.waiting:  #if waiting
            if self.waitingFor is not None:  #if we're waiting for an object
                if not self.waitingFor.busy:  #if what we're waiting for is no longer busy
                    self.waiting = False  #stop waiting
                    self.waitingFor = None  #no longer waiting for anything
            else:  #else
                self.countdown -= 1  #decrease the countdown
                if self.countdown <= 0:  #if we've finished counting down
                    self.waiting = False  #stop waiting

        while (not self.waiting and self.running
               ):  #while we're not waiting and still have commands to process
            cmd = self.script.commands[
                self.currentCommand]  #get the current command
            if cmd[0] == CMD_LOCK:  #if it's LOCK
                print "LOCK"
                self.game.player.lock()  #lock the player
                if self.caller.__class__.__name__ == "NPC":  #if the script has a caller
                    self.caller.lock()  #lock it
            elif cmd[0] == CMD_UNLOCK:  #if it's UNLOCK
                print "UNLOCK"
                self.game.player.unlock()  #unlock the player
                if self.caller.__class__.__name__ == "NPC":  #if the script has a caller
                    self.caller.unlock()  #unlock it
            elif cmd[0] == CMD_FACEPLAYER:  #if it's FACEPLAYER
                print "FACEPLAYER"
                difference = self.game.player.position[
                    0] - self.caller.position[0], self.game.player.position[
                        1] - self.caller.position[
                            1]  #calculate offset between player and caller
                if difference == (0, -1):  #if player is above caller
                    self.caller.direction = sprite.DIR_UP  #face UP
                elif difference == (0, 1):  #if player is below caller
                    self.caller.direction = sprite.DIR_DOWN  #face DOWN
                elif difference == (-1, 0):  #if player is to left of caller
                    self.caller.direction = sprite.DIR_LEFT  #face LEFT
                elif difference == (1, 0):  #if player is to right of caller
                    self.caller.direction = sprite.DIR_RIGHT  #face RIGHT
            elif cmd[0] == CMD_WAIT:  #if it's WAIT
                print "WAIT"
                self.waiting = True  #we're waiting
                self.waitingFor = None  #not waiting for an object
                self.countdown = cmd[1]  #set countdown as needed
            elif cmd[0] == CMD_MOVEME:  #if it's MOVEME
                print "MOVEME"
                self.caller.walkUp(cmd[1], True)  #walk, force move
                self.waiting = True  #we're waiting
                self.waitingFor = self.caller  #waiting for caller
            elif cmd[0] == CMD_DIALOG:  #if it's DIALOG
                print "DIALOG"
                text = map(self.resolveString,
                           cmd[1])  #resolve the text strings for variables
                d = dialog.Dialog(text, self.font, self.game.screen,
                                  cmd[2])  #create the dialog
                self.game.foregroundObject = d  #set it as the game's active object
                self.waiting = True  #we're waiting
                self.waitingFor = d  #waiting for the dialog
            elif cmd[0] == CMD_SETVAR:
                print "SETVAR"
                if cmd[1][0] == "$":
                    self.variables[cmd[1][1:-1]] = cmd[2]
                elif cmd[1][0] == "*":
                    self.game.savegame.variables[cmd[1][1:-1]] = cmd[2]
            elif cmd[0] == CMD_GETVAR:
                print "GETVAR"
                self.result = self.variables[cmd[1]]
            elif cmd[0] == CMD_COMPARE:  #if it's COMPARE
                print "COMPARE"
                self.result = (self.resolveString(
                    cmd[1]) == self.resolveString(cmd[2])
                               )  #store whether the two are equal
            elif cmd[0] == CMD_GOTO:  #if it's GOTO
                print "GOTO"
                self.currentCommand = cmd[
                    1] - 1  #go to the line before the one required, which will then be advanced to the correct line
            elif cmd[0] == CMD_IFFALSEGOTO:  #if it's IFFALSEGOTO
                print "IFFALSEGOTO"
                if not self.result:  #if comparison result is False
                    self.currentCommand = cmd[
                        1] - 1  #goto to the line before the one required, which will then be advanced to the correct line
            elif cmd[0] == CMD_MOVEPLAYER:  #if it's MOVEPLAYER
                print "MOVEPLAYER"
                self.game.player.walk(cmd[1], True)  #move the player
                self.waiting = True  #we're waiting
                self.waitingFor = self.game.player  #we're waiting for the player
            elif cmd[0] == CMD_CHOICEDIALOG:  #if it's CHOICEDIALOG
                print "CHOICEDIALOG"
                text = map(self.resolveString,
                           cmd[1])  #resolve the text for variables
                d = dialog.ChoiceDialog(text, self.font, self.game.screen,
                                        self,
                                        cmd[2])  #create the choice dialog
                self.game.foregroundObject = d  #set it as the game's active object
                self.waiting = True  #we're waiting
                self.waitingFor = d  #waiting for the choice dialog
            elif cmd[0] == CMD_SHOWSPRITE:  #if it's SHOWSPRITE
                print "SHOWSPRITE"
                if self.caller is not None:  #if there's a caller
                    if self.caller.__class__.__name__ == "Tilemap":  #if it was a map
                        self.caller.getSpriteById(
                            cmd[1]).visible = True  #set the sprite visible
                    elif self.caller.__class__.__name__ == "NPC":  #if it was an NPC
                        self.caller.map.getSpriteById(
                            cmd[1]).visible = True  #set the sprite visible
                else:  #else
                    self.game.player.map.getSpriteById(
                        cmd[1]).visible = True  #set the sprite visible
            elif cmd[0] == CMD_HIDESPRITE:  #if it's HIDESPRITE
                print "HIDESPRITE"
                if self.caller is not None:  #if there's a caller
                    if self.caller.__class__.__name__ == "Tilemap":  #if it was a map
                        self.caller.getSpriteById(
                            cmd[1]).visible = False  #set the sprite invisible
                    elif self.caller.__class__.__name__ == "NPC":  #if it was an NPC
                        self.caller.map.getSpriteById(
                            cmd[1]).visible = False  #set the sprite invisible
                else:  #else
                    self.game.player.map.getSpriteById(
                        cmd[1]).visible = False  #set the sprite invisible
            elif cmd[0] == CMD_WARP:
                print "WARP"
                if False:
                    p = self.game.player
                    del (p.map.sprites["PLAYER"])
                    p.map = tilemap.Tilemap(cmd[1], self)
                    p.map.loadConnections()
                    p.position = cmd[2]
                    p.destination = cmd[2]
                    p.level = cmd[3]
                    p.map.sprites["PLAYER"] = p
                    sound.playMusic(p.map.music)
                else:
                    p = self.game.player
                    mMap = tilemap.Tilemap(cmd[1], self)
                    p.transferTo(mMap, cmd[2])
                    p.destination = p.getPositionInFront()
                    p.level = cmd[3]
            elif cmd[0] == CMD_FADEOUTANDIN:
                print "FADEOUTANDIN"
                self.game.foregroundObject = foreground_object.FadeOutAndIn(
                    self.game.screen, cmd[1])
            elif cmd[0] == CMD_GIVEPOKEMON:
                print "GIVEPOKEMON"
                poke = pokemon.Pokemon(cmd[1], cmd[2])
                self.game.player.party.add(poke)
            elif cmd[0] == CMD_SURF:
                print "SURF"
                self.game.player.surf()

            self.currentCommand += 1  #advance to next command
            if self.currentCommand >= len(
                    self.script.commands
            ):  #if we've reached the end of the script
                if len(self.queue) == 0:
                    self.running = False  #no longer running
                else:
                    print "Script from queue"
                    s, caller = self.queue.pop()
                    self.running = True  #running a script
                    self.script = s  #store the script
                    self.caller = caller  #store the caller of the script
                    self.currentCommand = 0  #reset command counter to start
                    self.waiting = False  #not yet waiting
                    self.waitingFor = None  #not waiting for anything
                break  #stop processing