Example #1
0
# 遊戲物件
p1 = GO.Alien('zel', GO.Team.TeamA, (120, 360), (1, 0))
m1 = GO.Bacteria('Baekk', (1000, 360), (-1, 0))
m1 = GO.Bacteria('Baekk2', (1200, 360), (-1, 0))
bg = GO.Background(bg_img, (0, 0))
bg2 = GO.Background(bg_img, (1280, 0))
# 物件關係
GO.TriggerRegister(type='collision', attacker=GO.Bullets, victim=GO.Players)
GO.TriggerRegister(type='collision', attacker=GO.Bullets, victim=GO.Monsters)
GO.TriggerRegister(type='collision', attacker=GO.Words, victim=GO.Players)
GO.TriggerRegister(type='collision', attacker=GO.Monsters, victim=GO.Players)
# 暴露在main loop的setTimeout要新增一個True在List中,當lock flag
GO.TimerFlags = [True]
# for debug
GO.Words = [
    GO.Word('a'),
    GO.Word('b'),
    GO.Word('c'),
    GO.Word('c'),
    GO.Word('b'),
    GO.Word('c')
]

isHoldBackspace = False
running = True
while running:
    pygame.time.Clock().tick(30)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYDOWN: