コード例 #1
0
ファイル: world.py プロジェクト: grimfang/owp_ajaw
    def start(self):
        helper.hide_cursor()
        self.level.start()
        self.loadingscreen.setLoadingValue(55)
        self.player.start(self.level.getPlayerStartPoint())
        self.loadingscreen.setLoadingValue(65)
        self.hud.show()
        self.hud.updateKeyCount(0)
        self.loadingscreen.setLoadingValue(75)
        self.golem.start(self.level.getGolemStartPoint())
        self.loadingscreen.setLoadingValue(85)

        self.playMusic("Ambient")

        # catch all events that go from one class to another within the world
        # NOTE: events that stay in one class can be catched in the class itself
        #       to not pollute this class to much
        self.accept("Player_Activate", self.level.activateElement)
        self.accept("showMessage", self.msgWriter.setMessageAndShow)
        self.accept("ActionActive", self.hud.showActionKey)
        self.accept("ActionDeactive", self.hud.hideActionKey)
        self.accept("EnterFightMode", self.enterFight)
        self.accept("ExitFightMode", self.playMusic, ["ambient"])
        self.accept("PuzzleSolved", self.playSfx, ["puzzleSolved"])
        self.accept("updateKeyCount", self.hud.updateKeyCount)
        self.accept("player-die", self.player.die)
        self.accept("player-heal", self.player.heal)
        self.accept("setHealth", self.hud.setHealthStatus)
        self.accept("golemSeesPlayer", self.player.enterFightMode)
        self.accept("HitEnemy", self.golem.hit)
        self.accept("HitPlayer", self.player.hit)
        self.accept("GolemDestroyed", self.exitFight)
        self.accept("GameOver", self.gameOver)
        self.accept("Exit", base.messenger.send, ["escape"])
        self.loadingscreen.setLoadingValue(100)
        self.loadingscreen.hide()
        self.startTime = time.time()
        base.messenger.send("showMessage", [
            _("Welcome to path of Kings, follow the signposts and try to survive this dungeon.\nmove with the arrow keys or w a s d\n\nGood luck..."
              )
        ])
コード例 #2
0
ファイル: world.py プロジェクト: grimfang/owp_ajaw
    def start(self):
        helper.hide_cursor()
        self.level.start()
        self.loadingscreen.setLoadingValue(55)
        self.player.start(self.level.getPlayerStartPoint())
        self.loadingscreen.setLoadingValue(65)
        self.hud.show()
        self.hud.updateKeyCount(0)
        self.loadingscreen.setLoadingValue(75)
        self.golem.start(self.level.getGolemStartPoint())
        self.loadingscreen.setLoadingValue(85)

        self.playMusic("Ambient")

        # catch all events that go from one class to another within the world
        # NOTE: events that stay in one class can be catched in the class itself
        #       to not pollute this class to much
        self.accept("Player_Activate", self.level.activateElement)
        self.accept("showMessage", self.msgWriter.setMessageAndShow)
        self.accept("ActionActive", self.hud.showActionKey)
        self.accept("ActionDeactive", self.hud.hideActionKey)
        self.accept("EnterFightMode", self.enterFight)
        self.accept("ExitFightMode", self.playMusic, ["ambient"])
        self.accept("PuzzleSolved", self.playSfx, ["puzzleSolved"])
        self.accept("updateKeyCount", self.hud.updateKeyCount)
        self.accept("player-die", self.player.die)
        self.accept("player-heal", self.player.heal)
        self.accept("setHealth", self.hud.setHealthStatus)
        self.accept("golemSeesPlayer", self.player.enterFightMode)
        self.accept("HitEnemy", self.golem.hit)
        self.accept("HitPlayer", self.player.hit)
        self.accept("GolemDestroyed", self.exitFight)
        self.accept("GameOver", self.gameOver)
        self.accept("Exit", base.messenger.send, ["escape"])
        self.loadingscreen.setLoadingValue(100)
        self.loadingscreen.hide()
        self.startTime = time.time()
        base.messenger.send(
            "showMessage",
            [_("Welcome to path of Kings, follow the signposts and try to survive this dungeon.\nmove with the arrow keys or w a s d\n\nGood luck...")])
コード例 #3
0
    def enterGame(self):
        # main game code should be called here
        self.arena = Arena(self.levelSelection.selectedLevel)
        self.arena.start()
        self.camera.setPos(0, -5, 1.25)
        self.player = Player(0, self.selectedChar1, "p1")
        self.player2 = Player(1, self.selectedChar2, "p2")
        self.player.setEnemy(self.player2.collisionNodeName)
        self.player2.setEnemy(self.player.collisionNodeName)
        self.player.start(self.arena.getStartPos(1))
        self.player2.start(self.arena.getStartPos(2))
        self.taskMgr.add(self.updateWorldCam, "world camera update task")
        self.accept("gameOver", self.gameOver)
        self.hud.show()

        def lifeChanged(charId, health):
            base.messenger.send("hud_setLifeBarValue", [charId, health])

        self.accept("lifeChanged", lifeChanged)
        hide_cursor()
        if self.fightMusic.status() != AudioSound.PLAYING:
            self.fightMusic.play()
        if self.menuMusic.status() == AudioSound.PLAYING:
            self.menuMusic.stop()
コード例 #4
0
ファイル: main.py プロジェクト: jorjuato/panda3d-tutorial
 def enterGame(self):
     # main game code should be called here
     self.arena = Arena(self.levelSelection.selectedLevel)
     self.arena.start()
     self.camera.setPos(0, -5, 1.25)
     self.player = Player(0, self.selectedChar1, "p1")
     self.player2 = Player(1, self.selectedChar2, "p2")
     self.player.setEnemy(self.player2.collisionNodeName)
     self.player2.setEnemy(self.player.collisionNodeName)
     self.player.start(self.arena.getStartPos(1))
     self.player2.start(self.arena.getStartPos(2))
     self.taskMgr.add(self.updateWorldCam, "world camera update task")
     self.accept("gameOver", self.gameOver)
     self.hud.show()
     def lifeChanged(charId, health):
         base.messenger.send(
             "hud_setLifeBarValue",
             [charId, health])
     self.accept("lifeChanged", lifeChanged)
     hide_cursor()
     if self.fightMusic.status() != AudioSound.PLAYING:
         self.fightMusic.play()
     if self.menuMusic.status() == AudioSound.PLAYING:
         self.menuMusic.stop()
コード例 #5
0
ファイル: main.py プロジェクト: grimfang/owp_ajaw
    def enterIntro(self):
        helper.hide_cursor()
        cm = CardMaker("fade")
        cm.setFrameFullscreenQuad()
        self.gfLogo = NodePath(cm.generate())
        self.gfLogo.setTransparency(TransparencyAttrib.MAlpha)
        gfLogotex = loader.loadTexture('GrimFangLogo.png')
        gfLogots = TextureStage('gfLogoTS')
        gfLogots.setMode(TextureStage.MReplace)
        self.gfLogo.setTexture(gfLogots, gfLogotex)
        self.gfLogo.setY(-50)
        self.gfLogo.reparentTo(render2d)
        self.gfLogo.hide()

        self.pandaLogo = NodePath(cm.generate())
        self.pandaLogo.setTransparency(TransparencyAttrib.MAlpha)
        pandaLogotex = loader.loadTexture('Panda3DLogo.png')
        pandaLogots = TextureStage('pandaLogoTS')
        pandaLogots.setMode(TextureStage.MReplace)
        self.pandaLogo.setTexture(pandaLogots, pandaLogotex)
        self.pandaLogo.setY(-50)
        self.pandaLogo.reparentTo(render2d)
        self.pandaLogo.hide()

        gfFadeInInterval = LerpColorScaleInterval(
            self.gfLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,1.0),
            LVecBase4f(0.0,0.0,0.0,0.0))

        gfFadeOutInterval = LerpColorScaleInterval(
            self.gfLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,0.0),
            LVecBase4f(0.0,0.0,0.0,1.0))

        p3dFadeInInterval = LerpColorScaleInterval(
            self.pandaLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,1.0),
            LVecBase4f(0.0,0.0,0.0,0.0))

        p3dFadeOutInterval = LerpColorScaleInterval(
            self.pandaLogo,
            2,
            LVecBase4f(0.0,0.0,0.0,0.0),
            LVecBase4f(0.0,0.0,0.0,1.0))

        self.fadeInOut = Sequence(
            Func(self.pandaLogo.show),
            p3dFadeInInterval,
            Wait(1.0),
            p3dFadeOutInterval,
            Wait(0.5),
            Func(self.pandaLogo.hide),
            Func(self.gfLogo.show),
            gfFadeInInterval,
            Wait(1.0),
            gfFadeOutInterval,
            Wait(0.5),
            Func(self.gfLogo.hide),
            Func(self.request, "Menu"),
            Func(helper.show_cursor),
            name="fadeInOut")
        self.fadeInOut.start()
コード例 #6
0
ファイル: fsmGame.py プロジェクト: grimfang/Paintball
    def enterSingleplayer(self):
        helper.hide_cursor()

        self.musicGame.play()

        self.world = World()

        self.player = Player()
        self.player.setPos(self.world.getStartPos(1))
        self.player.setTeam("Yellow")
        self.player.setColor(LPoint3f(1, 1, 0))

        #self.player.setSpectator(self.world.getSpectatorNode())

        # create non player characters
        self.npcs = []
        for i in range(self.numNPCs):
            self.npcs.append(NPC())
            self.npcs[i].setPos(self.world.getStartPos(i+2))
            self.npcs[i].setBunker(self.world.getBunker())
            if i < self.numNPCs/2:
                self.npcs[i].setTeam("Yellow")
                self.npcs[i].setColor(LPoint3f(1, 1, 0))
            else:
                self.npcs[i].setTeam("Blue")
                self.npcs[i].setColor(LPoint3f(0, 0, 1))

        for i in range(self.numNPCs):
            el = []
            if self.npcs[i].playerTeam != self.player.playerTeam:
                el.append(self.player)
            for j in range(self.numNPCs):
                if self.npcs[i].playerTeam != self.npcs[j].playerTeam:
                    el.append(self.npcs[j])
            self.npcs[i].setEnemies(el)


        number = OnscreenText(
            text = "",
            scale = 0.75,
            pos = (0, -0.1875),
            fg = (1,1,1,1),
            align = TextNode.ACenter)

        def startSingleplayer():
            number.destroy()
            self.world.run()
            self.player.run()
            for npc in self.npcs:
                npc.run()
            taskMgr.add(self.checkGameOver, "checkGameOver")

        def setNumber(num):
            number["text"] = str(num)
            number["scale"] = 0.75
        inter = number.scaleInterval(1.0, 0)
        # setup a sequence that will count down for us
        self.countdownSeq = Sequence(
            Func(setNumber, 3),
            inter,
            Func(setNumber, 2),
            inter,
            Func(setNumber, 1),
            inter,
            Func(setNumber, "GO"),
            inter,
            Func(startSingleplayer))
        self.countdownSeq.start()
コード例 #7
0
ファイル: __main__.py プロジェクト: shivamsn97/SafePass
def check_substr():
    clear()
    print_title()
    strx = input(
        Fore.GREEN +
        "Enter the sub-string you want to search in Password Database: " +
        Fore.RED +
        "\n(It is CASE SENSITIVE and SPACES will also be counted)\n\n" +
        Fore.WHITE + "#" + Fore.BLUE + "")
    i = 0
    #(Found, File) = (False, None)
    clear()
    print_title()
    print(Fore.GREEN + "\nSearching for " + Fore.RED + strx + Fore.GREEN +
          " and its Sub-Strings in Password Database.\n")
    print(Fore.WHITE +
          "It may take Several Minutes. To interrupt, Press CTRL+C.\n\n")
    hide_cursor()
    num = 0
    try:
        total_pass = 0
        for x in files:
            total_pass = total_pass + file_len(data_path + '/' + x)

        for x in files:
            file = open(data_path + '/' + x, 'r', encoding='latin1')
            (c, r) = get_terminal_size()
            print(Back.CYAN + (c - 1) * ' ', end='\r')

            for line in file:
                line = line.strip()
                #(c, r) = get_terminal_size()
                #print (Back.BLUE + (c-1)*' ', end = '\r')
                i = i + 1
                zx = Back.CYAN + Fore.BLACK + "Checking " + Fore.MAGENTA + "{:>13}".format(
                    line[:13]
                ) + Fore.BLACK + " in file " + Fore.MAGENTA + "{:>25}  ".format(
                    x[:25]) + Fore.RED + str((i * 100) // total_pass) + "%"
                print(zx, end='\r')
                l = line.find(strx)
                if (l is not -1):
                    num = num + 1
                    #l = line.find (strx)
                    lenx = len(strx)
                    linex = Fore.BLUE + line[:l] + Fore.MAGENTA + line[
                        l:l + lenx] + Fore.BLUE + line[lenx:]
                    (c, r) = get_terminal_size()
                    print(Back.BLACK + (c - 1) * ' ', end='\r')
                    print(Fore.WHITE + "{:>6}: ".format(num) + " " + linex +
                          " " + Style.DIM + Fore.WHITE + " in " + Fore.BLUE +
                          x + Style.RESET_ALL)
                    (c, r) = get_terminal_size()
                    print(Back.CYAN + (c - 1) * ' ', end='\r')
            file.close()
        (c, r) = get_terminal_size()
        print(Back.BLACK + (c - 1) * ' ', end='\r')

        print(Fore.GREEN + "\n\n[+]" + Fore.WHITE +
              " Script Succeded. Result was " + Fore.BLUE +
              "{} result(s)".format(num) + Fore.WHITE)
    except KeyboardInterrupt:
        (c, r) = get_terminal_size()
        print(Back.BLACK + (c - 1) * ' ', end='\r')
        print(Fore.GREEN + "\n[+]" + Fore.WHITE +
              " Script Succeded. Result was " + Fore.BLUE +
              "Interrupted by User, {} results found.".format(num) +
              Fore.WHITE)
    show_cursor()
    exit(0)
コード例 #8
0
ファイル: __main__.py プロジェクト: shivamsn97/SafePass
def check_one():
    clear()
    #print ("in check 1")
    print_title()
    strx = input(
        Fore.GREEN + "Enter the password you want to check: " + Fore.RED +
        "\n(It is CASE SENSITIVE and SPACES will also be counted)\n\n" +
        Fore.WHITE + "#" + Fore.BLUE + "")
    i = 0
    (Found, File) = (False, None)
    clear()
    print_title()
    print(Fore.GREEN + "\nSearching for " + Fore.RED + strx + Fore.GREEN +
          " in Password Database.\n")
    print(Fore.WHITE +
          "It may take Several Minutes. To interrupt, Press CTRL+C.\n\n")
    hide_cursor()
    try:
        total_pass = 0
        for x in files:
            total_pass = total_pass + file_len(data_path + '/' + x)

        for x in files:
            if Found:
                break
            file = open(data_path + '/' + x, 'r', encoding='latin1')
            (c, r) = get_terminal_size()
            print(Back.CYAN + (c - 1) * ' ', end='\r')

            for line in file:
                line = line.strip()
                #(c, r) = get_terminal_size()
                #print (Back.BLUE + (c-1)*' ', end = '\r')
                i = i + 1
                zx = Back.CYAN + Fore.BLACK + "Checking " + Fore.MAGENTA + "{:>13}".format(
                    line[:13]
                ) + Fore.BLACK + " in file " + Fore.MAGENTA + "{:>25}  ".format(
                    x[:25]) + Fore.RED + str((i * 100) // total_pass) + "%"
                print(zx, end='\r')
                if (line == strx):
                    (Found, File) = (True, x)
                    file.close()
                    break
            file.close()
        (c, r) = get_terminal_size()
        print(Back.BLACK + (c - 1) * ' ', end='\r')
        if Found:
            print(
                Fore.RED +
                "Your password was available in the password database in file "
                + Fore.BLUE + File + Fore.RED +
                ". You should immediately change this password if u have used it somewhere."
            )
        else:
            print(
                Fore.GREEN +
                "Great! Your password is not available in any of the Password Database, and it should be secure enough."
            )

        print(Fore.GREEN + "\n\n[+]" + Fore.WHITE +
              " Script Succeded. Result was " + Fore.BLUE +
              ("Unsecure Password" if Found else "Secure Password") +
              Fore.WHITE)
    except KeyboardInterrupt:
        (c, r) = get_terminal_size()
        print(Back.BLACK + (c - 1) * ' ', end='\r')
        print(Fore.GREEN + "\n[+]" + Fore.WHITE +
              " Script Succeded. Result was " + Fore.BLUE +
              "Interrupted by User" + Fore.WHITE)
    show_cursor()
    exit(0)