def _readMultiActions(self, game):
""" Read multiple simultaneously pressed button actions. """
from pygame.locals import K_LEFT, K_RIGHT, K_UP, K_DOWN, K_a, K_s, K_d, K_w
res = []
if self.alternate_keys:
if game.keystate[K_d]: res += [RIGHT]
elif game.keystate[K_a]: res += [LEFT]
if game.keystate[K_w]: res += [UP]
elif game.keystate[K_s]: res += [DOWN]
else:
if game.keystate[K_RIGHT]: res += [RIGHT]
elif game.keystate[K_LEFT]: res += [LEFT]
if game.keystate[K_UP]: res += [UP]
elif game.keystate[K_DOWN]: res += [DOWN]
return res
评论列表
文章目录