本文整理汇总了Python中Block.Block.collision方法的典型用法代码示例。如果您正苦于以下问题:Python Block.collision方法的具体用法?Python Block.collision怎么用?Python Block.collision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block.Block
的用法示例。
在下文中一共展示了Block.collision方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StageThree
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import collision [as 别名]
#.........这里部分代码省略.........
if event.key == K_w:
gunner.moveup()
if event.key == K_s:
gunner.movedown()
if event.key == K_a:
gunner.moveleft()
if event.key == K_d:
gunner.moveright()
elif event.type == KEYUP:
if event.key == K_a or event.key == K_d or event.key == K_w or event.key == K_s:
gunner.state = "still"
if pygame.sprite.spritecollide(gunner, ashots, dokill):
gunner.bleed(blood)
gunner.life = gunner.life - 10
gunner.knockback()
if pygame.sprite.groupcollide(shadows, blade, dokill, dontkill) or pygame.sprite.groupcollide(shadows, shots, dokill, dokill):
a = "Assassin: What's the matter? Can't hit me? Haha!"
b = "Assassin: Come on, stop trying to hit me and hit me!"
c = "Assassin: What are you swinging at? I'm right here!"
d = "Assassin: Bwahahahaha!"
e = "Assassin: Super ketchup, premio tomato, catfish tuna."
msg = random.choice((a, b, c, d, e))
newText = Text(msg)
objects.add(newText)
shadows.empty()
SALIVE = 0
if pygame.sprite.spritecollide(assassin, blade, dontkill):
assassin.bleed(blood)
assassin.life = assassin.life - 2
score.plus(1)
if pygame.sprite.spritecollide(assassin, shots, dokill):
assassin.bleed(blood)
assassin.life = assassin.life - 5
score.plus(1)
if pygame.sprite.spritecollide(assassin, pshots, dontkill):
assassin.bleed(blood)
assassin.life = assassin.life - 8
score.plus(1)
if pygame.sprite.groupcollide(blocks, heroes, dontkill, dontkill):
if hero == "tesi":
middle.collision(tesi)
if hero == "gunner":
middle.collision(gunner)
if pygame.sprite.groupcollide(blocks, gassassin, dontkill, dontkill):
middle.collision(assassin)
if assassin.life <= 0:
if CHECKMARK1 == 0:
msg = "Professor: Incredible, you defeated 'The Assassin'! Yippie!"
newText = Text(msg)
objects.add(newText)
CHECKMARK1 = 1
shadows.clear(screen, background)
shadows.update()
shadows.draw(screen)
blood.clear(screen, background)
blood.update()
blood.draw(screen)
shots.clear(screen, background)
shots.update()
shots.draw(screen)
pshots.clear(screen, background)
pshots.update()
pshots.draw(screen)
ashots.clear(screen, background)
ashots.update()
ashots.draw(screen)
fakeshots.clear(screen, background)
fakeshots.update()
fakeshots.draw(screen)
blade.clear(screen, background)
blade.update()
blade.draw(screen)
objects.clear(screen, background)
objects.update()
objects.draw(screen)
blocks.clear(screen, background)
blocks.update()
blocks.draw(screen)
pygame.display.flip()