Exemple #1
0
 flg1 = 0
 if check["move_up"]:
     mando.move_up(board)
     flg1 = 1
 if check["move_down"]:
     mando.move_down(board, ttt)
     flg1 = 1
 if check["move_right"]:
     mando.move_right(4, st, board, dragon_finished)
     flg1 = 1
 if check["move_left"]:
     mando.move_left(st, board)
     flg1 = 1
 if flg1 == 1:
     ttt = 1.2
 dragon_lives = dragon.get_lives()
 mando.add_to_board(board, st, st0, dragon_came, dragon_lives)
 if st >= 1961 and fir == 1:
     fir = 0
     if dragon_came == False:
         dragon_came = True
         time_for_fire = time.time() - 2
 elif fir == 1:
     st = st + 1
 board.printboard(st, dragon_came)
 if flg == 1:
     if mando.decrease_lives() == 0:
         cursor_show()
         mando.game_over()
     else:
         flg = 0
Exemple #2
0
            shield.activate(manda)
    if char == 'p':
        mbullet.eject(manda)

    if char == 'o':
        mbullet.printlist()
        quit()
    return 2


prev = 0
while True:
    timenow = time.time() - stime
    if (manda.get_lives() <= 0):
        gameover("No lives left!!!")
    if (dragon.get_lives() <= 0):
        gameover("Congrats!!!You wom.")
    mbullet.bullet_handler()
    if (manda.get_xcoo() > 320):
        dbullet.eject(dragon)
        dbullet.bullet_handler()
        manda.stillcheck()
    retvar = movemanda()
    movecheck = 0
    if (retvar != 3):
        movecheck = manda.movedown(timenow)
        dragon.movedown(timenow, manda)
    else:
        manda.gravity_reset()
        dragon.gravity_reset()
    check_magnet = 0
Exemple #3
0
        if magnet.get_pos()-magnet.get_affect() < din.get_pos()[0]+board.get_current_pos() and magnet.get_pos()>din.get_pos()[0]+board.get_current_pos():
            din.set_xacc(8)
            print(pos(0,120)+"Magnet Front")
        elif magnet.get_pos()+magnet.get_affect() > din.get_pos()[0]+board.get_current_pos() and magnet.get_pos()<din.get_pos()[0]+board.get_current_pos():
            din.set_xacc(-8)
            print(pos(0,120)+"Magnet Back ")
        else:
            din.set_xacc(0)
            print(pos(0,120)+'            ')
        

        time.sleep(0.05)

        print(pos(0,70)+"                     ") # Shield bar
        print(pos(0,20)+"Lives:{}".format(din.get_lives()))
        print(pos(0,40)+"Score:{}".format(din.get_score()))
        if din.get_ended():
            print(pos(0,170)+"Dragon Lives:{}".format(dragon.get_lives()))
        

        sys.stdout.flush()
    while kb.kbhit():
        kb.getch()
    kb.set_normal_term()
    print(chr(27)+'[2j')
    print('\033c')
    print('\x1bc')
    print('Score:{}'.format(din.get_score()))
    print('You Win' if din.get_lives() and din.get_ended() else 'You Lose')