예제 #1
0
    x = random.randint(1, 33)
    y = random.randint(30 + i * 20, 240 + i * 20)
    for j in range(c1):
        for k in range(c2):
            coin.place(board.matrix, x + j, y + k)
magnet = Magnet()
magnet.loadObstacle('magnet')
x1 = 20
x2 = 200
magnet.place(board.matrix, x1, x2)
mando = Mando()
mando.loadMando(board.matrix, 'n', cnt)
board.printBoard(cnt, config.dragon_lives)
dragon = Dragon()
dragon.loadObstacle('dragon')
dragon.place(board.matrix, 20, 445)
st = time.time()
prev_gravity_time = time.time()
dBtime = time.time()
shield_time = time.time()
gtime = time.time()
flag = 'G'
bullets = []
dragon_bullets = []
while True:
    p = user_input()
    if config.time <= 0:
        flag = 'T'
        break
    if config.dragon_lives <= 0:
        while mando.xpos < 32:
예제 #2
0
from input import user_input
from board import Board
from mando import Mando
from coins import Coin
from firebeam import Firebeam
from magnet import Magnet
from dragon import Dragon
from time import time
from bullet import Bullet
from random import randint
screen = Board(40, 10000)
man = Mando(35, 3)
man.place(screen)

drag = Dragon(30, 500)
drag.place(screen)
for i in range(40):
    x = randint(5, 30)
    y = randint(25, 450)
    coin_p = Coin(x, y)
    coin_p.place(screen)

for j in range(10, 30):
    x = randint(5, 30)
    y = randint(50, 350)
    beam = Firebeam(x, y)
    beam.place(screen)

mag = Magnet(2, 80)
mag.place(screen)