示例#1
0
 def click(self, clickx, clicky, noneSelected):
     if self._present:
         if self.inInventory and clickx > self._position[
                 0] and clickx < self._position[
                     0] + 64 and clicky > self._position[
                         1] and clicky < self._position[1] + 64:
             if self.selected:  #   If the item is currently selected, unselect it.
                 self.displayNameBelow(False)
                 self.changeSprite(self._inventoryRestingSprite)
                 self.selected = False
             elif noneSelected:  #   If the item is currently unselected, select it.
                 self.displayNameBelow(True)
                 self.changeSprite(self._inventorySelectedSprite)
                 self.selected = True
             return True
         elif noneSelected and clickx > self._position[
                 0] and clickx < self._position[0] + self._size[
                     0] and clicky > self._position[
                         1] and clicky < self._position[1] + self._size[
                             1] and self.canInteract(
                             ):  #   If the item is not currently in the inventory, then it must be collected and added to the inventory.
             self.inInventory = True
             self._present = False
             self._couldBeInteractedWith = False
             self._canvas.delete(self.__thisObject)
             self._inventory.addItem(self)
             return True
     if self.selected and self.effect != None and not self.effect(
             self, self.objectsOfInteraction, clickx, clicky):
         infobox = Infobox(self._canvas, "You can't do that.", 1500)
         infobox.show()
         return True
     return False
示例#2
0
 def click(self, clickx, clicky, noneSelected):
     if not self._present or clickx < self._position[
             0] or clickx > self._position[0] + self._size[
                 0] or clicky < self._position[1] or clicky > self._position[
                     1] + self._size[1] or not self.canInteract():
         return
     if self.__outside:
         Infobox(self._canvas, "If you go this way, Brian will get you!",
                 3000).show()
         return
     if self.__key != None and not self.__key.isInInventory(
     ) or self.__nextRoom == None:
         Infobox(self._canvas, "This door is locked!", 3000).show()
         return
     if self.__dark and not (
             self.__flashlight.isInInventory()
             and self.__battery.isInInventory()):  #add "has flashlight"
         print(self.__flashlight.isInInventory())
         print(self.__battery.isInInventory())
         Infobox(self._canvas, "This room is too dark to enter!",
                 3000).show()
         return
     self._player.setPosition(self.__nextPosition[0],
                              self.__nextPosition[1])
     self.__thisRoom.unloadRoom()
     #   Reloading the room fixes bugs with items being present when they shouldn't be
     self.__thisRoom.loadRoom()
     self.__thisRoom.unloadRoom()
     self.__nextRoom.loadRoom()
示例#3
0
def funkyFrostingFuelEffect(fuel, darbyCart, clickx, clicky):
    global darbyCartHasGas
    if darbyCart.click(clickx, clicky, False):
        fuel._inventory.removeItem(fuel)
        darbyCartHasGas = True
        infobox = Infobox(canvas, "You put the fuel in the Darby Cart.", 2500)
        infobox.show()
        return True
    return False
示例#4
0
def darbyCartKeysEffect(keys, darbyCart, clickx, clicky):
    global darbyCartHasKey
    if darbyCart.click(clickx, clicky, False):
        keys._inventory.removeItem(keys)
        keys.depopulate()
        darbyCartHasKey = True
        infobox = Infobox(canvas, "You put the keys in the ignition.", 2500)
        infobox.show()
        return True
    return False
示例#5
0
 def addItem(self, item):
     infobox = Infobox(self.__canvas, "You got: " + item.name, 2500)
     infobox.show()
     reopen = False
     if self.__open:
         self.closeInventory()
         reopen = True
     self.items[item.name] = item
     sorted(self.items)
     if reopen: self.openInventory()
     item.inInventory = True
示例#6
0
def start(event):
    if event == 1:
        inventory.active(False)
        boysBathroom.unloadRoom()
        darkRoom.loadRoom()
    elif event == 3:
        darkRoom.unloadRoom()
        nexus.loadRoom()
    elif event == 6:
        nexus.unloadRoom()
        juniorHallway.loadRoom()
    if event == 5:
        info = Dialogue(canvas, infoText[event], 'Loudspeaker',
                        sprites.loudspeaker, nexus, None, player, inventory)
        info.show()
        isDialogueGone(event, info)
    elif event < len(infoText):
        info = Infobox(canvas, infoText[event], 3000)
        info.show()
        root.after(3000, start, event + 1)
    else:
        inventory.active(True)
        loop()
        info = Dialogue(canvas, writeObject.chanas1(), 'Mr. Hanas',
                        sprites.hanasface, juniorHallway, mrHanas, player,
                        inventory)
        info.show()
示例#7
0
def darbyCartEffect(thisCart):
    global darbyCartHasKey, darbyCartHasGas, winByAbandonment
    if darbyCartHasKey and darbyCartHasGas:
        winByAbandonment(0)
    elif not darbyCartHasKey:
        infobox = Infobox(canvas, "The key is missing.", 1500)
        infobox.show()
    else:
        infobox = Infobox(canvas, "The gas tank is empty.", 1500)
        infobox.show()
示例#8
0
    def build_interface(self):

        self.tutorial_label = Tutorial_Label(
            self.iconsize,
            self.iconratio_x,
            size_hint=(None, None),
            size=(8 * self.iconsize, self.iconsize),
            pos_hint={
                'x': 1 - 8 * self.iconratio_x - 0.2,
                'y': 0.875
            })

        self.infobox = Infobox(size_hint=(0.2, 0.2),
                               pos_hint={
                                   'x': 0.8,
                                   'y': 0.8
                               })

        self.seltoggles = Seltoggles(self.iconsize,
                                     self.iconratio_x,
                                     size_hint=(None, None),
                                     size=(7 * self.iconsize, self.iconsize),
                                     pos_hint={
                                         'x': 1 - 7 * self.iconratio_x,
                                         'y': 0
                                     })

        self.gamezone = Gamezone(
            # zooming stuff can be deactivated:
            # do_rotation=False,
            # do_translation_y=False,
            # do_translation_x=False,
            auto_bring_to_front=False,
            scale_min=0.15,
            scale_max=10,
            size_hint=(25, 25))
        self.add_widget(self.gamezone)

        self.menupanel = MenuPanel(self.iconsize,
                                   self.iconratio_y,
                                   size_hint=(None, None),
                                   size=(self.iconsize,
                                         3.0 * (Window.height / 8)),
                                   pos_hint={
                                       'x': 0,
                                       'y': 0
                                   })

        self.tutorial_label.register_menupanel(self.menupanel)
        self.add_widget(self.menupanel)

        self.add_menupanel = AddMenuPanel(self.iconsize,
                                          self.iconratio_y,
                                          size_hint=(None, None),
                                          size=(self.iconsize * 4,
                                                self.iconsize),
                                          pos_hint={
                                              'x': 0,
                                              'y': 7 * self.iconratio_y
                                          })

        self.add_widget(self.add_menupanel)

        self.slider_panel = SliderPanel(self.iconsize,
                                        self.iconratio_y,
                                        size_hint=(None, None),
                                        size=(self.iconsize * 5,
                                              self.iconsize),
                                        pos_hint={
                                            'x': 1 - self.iconratio_x * 5,
                                            'y': 0.5
                                        })

        self.add_widget(self.slider_panel)
示例#9
0
def pedestalEffect(thisPedestal):
    infobox = Infobox(canvas, "It's a strange-looking pedestal.", 1500)
    infobox.show()
示例#10
0
def iceOnStairsEffect(thisIce):
    infobox = Infobox(canvas, "The ice is sitting at the top of the stairs.",
                      1500)
    infobox.show()
示例#11
0
def calculatorOnPedestalEffect(thisCalculator):
    infobox = Infobox(canvas, "The calculator is sitting on the pedestal.",
                      1500)
    infobox.show()
示例#12
0
def chunkOfIceEffect(thisChunkOfIce):
    infobox = Infobox(canvas, "Wow! That's a big piece of ice!", 1500)
    infobox.show()
示例#13
0
def lose(event):
    if event == 0:
        player.enabled = False
        inventory.active(False)
        brian.populate()
        info = Infobox(canvas, 'Brian has been summoned!', 2500)
        info.show()
        root.after(2500, lose, 1)
    if event == 1:
        info = Infobox(canvas, 'Foolishly, you have not prepared for Brian.',
                       2500)
        info.show()
        root.after(2500, lose, 2)
    if event == 2:
        brian.depopulate()
        brian.populate(308, 570)
        info = Infobox(canvas, 'Beep Boop. Ya ded.', 1500)
        info.show()
        root.after(1500, lose, 3)
    if event == 3:
        stairwell.unloadRoom()
        Room([], [],
             sprites.titleCards[4],
             canvas,
             inventory,
             titleCard=True,
             player=player).loadRoom()
示例#14
0
def winByIce(event):
    if event == 0:
        player.enabled = False
        inventory.active(False)
        brian.populate()
        info = Infobox(canvas, 'Brian has been summoned!', 2500)
        info.show()
        root.after(2500, winByIce, 1)
    if event == 1:
        brian.depopulate()
        brianFallen.populate()
        info = Infobox(canvas, 'Whoops! There he goes!', 2500)
        info.show()
        root.after(2500, winByIce, 2)
    if event == 2:
        info = Infobox(canvas, "He's fallen and he can't get up! He ded.",
                       2500)
        info.show()
        root.after(2500, winByIce, 3)
    if event == 3:
        stairwell.unloadRoom()
        Room([], [],
             sprites.titleCards[3],
             canvas,
             inventory,
             titleCard=True,
             player=player).loadRoom()
示例#15
0
def tooFar():
    Infobox(canvas, "If you go this way, Brian will get you!", 3000).show()