コード例 #1
0
def drawScreen():
    global pokemon
    if mousePressed:
        if mouseX in range(55, 167) and mouseY in range(232, 364):
            pokemon = "squirtle"
            Battle_Screen.lil = True
            setSelectionState(False)
            Adventure.setAdventureState(True)
            StartMenu.setStartState(False)
            Battle_Screen.setBattleState(False)
            Adventure.setupScreen()
            Lil = True

        if mouseX in range(241, 362) and mouseY in range(244, 344):
            pokemon = "bulbasaur"
            Battle_Screen.blub = True
            setSelectionState(False)
            Adventure.setAdventureState(True)
            StartMenu.setStartState(False)
            Battle_Screen.setBattleState(False)
            Adventure.setupScreen()
            Bul = True

        if mouseX in range(426, 564) and mouseY in range(227, 361):
            pokemon = "charmander"
            Battle_Screen.cha = True
            setSelectionState(False)
            Adventure.setAdventureState(True)
            StartMenu.setStartState(False)
            Battle_Screen.setBattleState(False)
            Adventure.setupScreen()
            Cha = True
コード例 #2
0
ファイル: Adventure.py プロジェクト: JoshLew7/PokeRunner
def drawScreen():
    global newCity,city
    global backgroundImg,sprite
    global playerX,playerY
    global grassBLX,grassBLY,pokeBLX,pokeBLY
    global frontFacing,backFacing,leftFacing,rightFacing
    image(backgroundImg,0,0,600,600)
    image(sprite,playerX,playerY,25,25)
    playerMiddleX = playerX + 12
    playerMiddleY = playerY + 12

    if (keyPressed):
        if (key == 'w'):
            sprite = backFacing
            playerY -= 2
        elif(key == 's'):
            sprite = frontFacing
            playerY += 2
        elif(key == 'a'):
            sprite = leftFacing
            playerX -= 2
        elif(key == 'd'):
            sprite = rightFacing
            playerX += 2
    
    if playerX in range(pokeBLX1,pokeBLX1 + 25) and playerY in range(pokeBLY1,pokeBLY1 + 25) or playerX in range(pokeBLX2,pokeBLX2 + 25) and playerY in range(pokeBLY2,pokeBLY2 + 25) :
        # print("detect bot left")
        setAdventureState(False)
        PokeSelection.setSelectionState(False)
        StartMenu.setStartState(False)
        Battle_Screen.setBattleState(True)
        Battle_Screen.setupScreen()

    elif playerX in range(pokeBRX1,pokeBRX1 + 25) and playerY in range(pokeBRY1,pokeBRY1 + 25) or playerX in range(pokeBRX2,pokeBRX2 + 25) and playerY in range(pokeBRY2,pokeBRY2 + 25):
        # print("detect bot right")
        setAdventureState(False)
        PokeSelection.setSelectionState(False)
        StartMenu.setStartState(False)
        Battle_Screen.setBattleState(True)
        Battle_Screen.setupScreen()

    elif playerX in range(pokeTRX1,pokeTRX1 + 25) and playerY in range(pokeTRY1,pokeTRY1 + 25) or playerX in range(pokeTRX2,pokeTRX2 + 25) and playerY in range(pokeTRY2,pokeTRY2 + 25) :
        # print("detect top right")
        setAdventureState(False)
        PokeSelection.setSelectionState(False)
        StartMenu.setStartState(False)
        Battle_Screen.setBattleState(True)
        Battle_Screen.setupScreen()

    elif playerX in range(pokeTLX1,pokeTLX1 + 25) and playerY in range(pokeTLY1,pokeTLY1 + 25) or playerX in range(pokeTLX2,pokeTLX2 + 25) and playerY in range(pokeTLY2,pokeTLY2 + 25) :
        # print("detect top left")
        setAdventureState(False)
        PokeSelection.setSelectionState(False)
        StartMenu.setStartState(False)
        Battle_Screen.setBattleState(True)
        Battle_Screen.setupScreen()
        
    #To get the boundaries print mouse x mouse y and get top right bot left corner
    if playerX in range(0,328) and playerY in range(285,347): #Left River
        if playerY < 325:
            playerY = 284
        else:
            playerY = 348
    elif playerX in range(375,541) and playerY in range(285,347): #Right River
        if playerY < 325:
            playerY = 284
        else:
            playerY = 348
    elif playerX > 507: #Right Trees
        playerX = 506
    elif playerX < 28 and playerY in range(285,600):
        playerX = 29
    elif playerX in range(0,328) and playerY > 527:
        playerY = 526
    elif playerX in range(385,600) and playerY > 527:
        playerY = 526
    elif playerY > 585:
        backgroundImg = newCity
        playerX = 332
        playerY = 25
    elif playerY < 6:
        backgroundImg = city
        playerX = 350
        playerY = 580
コード例 #3
0
def drawScreen():
    global HealthBoxY, HealthBoxB, health
    global enemyHealth, Health, enemyattacklist, enemypicturelist, enemy
    global run, playersTurn

    enemyattacklist = [70, 60, 10]

    if timer.timeElapse() > 950:
        playersTurn = True

    if enemyHealth <= 0:
        Adventure.setupScreen()
        StartMenu.setStartState(False)
        PokeSelection.setSelectionState(False)
        setBattleState(False)
        Adventure.setAdventureState(True)

    if Health <= 0:
        StartMenu.setupScreen()
        StartMenu.setStartState(True)
        PokeSelection.setSelectionState(False)
        setBattleState(False)
        Adventure.setAdventureState(False)

    if mousePressed and mouseX >= 410 and mouseX <= 550 and mouseY >= 480 and mouseY <= 532:
        run = True
        Adventure.setAdventureState(True)
        Adventure.setupScreen()

    # bulbaTrap's attacks
    if bulb == True:
        img2 = loadImage("gold-silver-back.png")
        image(img2, 95, 325, 120, 120)
        image(enemy, 395, 115, 150, 150)

        # growl
        if mousePressed and playersTurn == True and mouseX <= 190 and mouseX >= 40 and mouseY <= 540 and mouseY >= 490:
            enemyHealth = enemyHealth - 25
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        #tackle
        if mousePressed and playersTurn == True and mouseX >= 30 and mouseX <= 180 and mouseY <= 490 and mouseY >= 50:
            enemyHealth = enemyHealth - 30
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # vine whip
        if mousePressed and playersTurn == True and mouseX <= 355 and mouseX >= 205 and mouseY >= 450 and mouseY <= 500:
            enemyHealth = enemyHealth - 70
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # toxic
        if mousePressed and playersTurn == True and mouseX >= 205 and mouseX <= 355 and mouseY >= 510 and mouseY <= 560:
            enemyHealth = enemyHealth - 50
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

    # cha fuego's attacks
    if cha == True:
        image(enemy, 395, 115, 150, 150)
        img2 = loadImage("charback.png")
        image(img2, 100, 350, 100, 100)

        # scratch
        if mousePressed and playersTurn == True and mouseX <= 190 and mouseX >= 40 and mouseY <= 540 and mouseY >= 490:
            enemyHealth = enemyHealth - 40
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # slash
        if mousePressed and playersTurn == True and mouseX >= 30 and mouseX <= 180 and mouseY <= 490 and mouseY >= 50:
            enemyHealth = enemyHealth - 70
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # ember
        if mousePressed and playersTurn == True and mouseX <= 355 and mouseX >= 205 and mouseY >= 450 and mouseY <= 500:
            enemyHealth = enemyHealth - 40
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # fire spin
        if mousePressed and playersTurn == True and mouseX >= 205 and mouseX <= 355 and mouseY >= 510 and mouseY <= 560:
            enemyHealth = enemyHealth - 35
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

    # lil squirt attacks
    if lil == True:
        img2 = loadImage("squback.png")
        image(img2, 100, 310, 160, 160)
        image(enemy, 395, 115, 150, 150)

        # headbutt
        if mousePressed and playersTurn == True and mouseX <= 190 and mouseX >= 40 and mouseY <= 540 and mouseY >= 490:
            enemyHealth = enemyHealth - 70
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # tail whip
        if mousePressed and playersTurn == True and mouseX >= 30 and mouseX <= 180 and mouseY <= 490 and mouseY >= 50:
            enemyHealth = enemyHealth - 35
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # bubble
        if mousePressed and playersTurn == True and mouseX <= 355 and mouseX >= 205 and mouseY >= 450 and mouseY <= 500:
            enemyHealth = enemyHealth - 40
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

        # water gun
        if mousePressed and playersTurn == True and mouseX >= 205 and mouseX <= 355 and mouseY >= 510 and mouseY <= 560:
            enemyHealth = enemyHealth - 40
            playersTurn = False

            timer.startTimer()
            Health -= (enemyattacklist[randint(0, 2)])

#Update Health
# fill(255)
# rect(10, 15, 205, 50)
# textSize(36)
# fill(0)
    textSize(20)
    image(HealthBoxY, 10, 25, 205, 50)
    image(health, 25, 35)
    stroke(0)
    fill(0)
    text(enemyHealth, 110, 56)

    image(HealthBoxY, 380, 305, 205, 50)
    image(health, 395, 315)
    text(Health, 480, 335)