[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] simple examples
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] simple examples
- From: "Ian Mallett" <geometrian@xxxxxxxxx>
- Date: Sat, 9 Feb 2008 15:59:39 -0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sat, 09 Feb 2008 19:00:23 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=5a5F2kS2ywL7YF87UCWdGSM3cKORu8KA8XbWJT5Q7qE=; b=Ge2ZBhs+Df9suMfrsLJw6PAOxgHtaHJqQ1CkbntoYmpNLQv9w2Oti0T3qlIqZNuTQ+GWtjhrj9qEOMJVldKuDVRU1RLMX5BdednLKcIuCXL/qCVT1kLJuMzCoX3+lnX8OwaGmlQlq8ewWTl/7Rya+RcTeh/8JzqEpmcdohIXMI0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=ry4/xI7dSZvTI0eA2/MPTRFISF/6qqrsFvODd//p/v3Iq+4Sxgkzu/H+TCkaKWsjabJwPElDBTUlShjFE9r9pZplrApu2wxTh+P8nSdiflcMQhyKVPV2OGd+HGpEheqaGOqJ90RH7l1SEJ9s3rW6ziFPZzpEDYK8Wcm/YmLDL5E=
- In-reply-to: <200802092352.58848.mr@xxxxxxxxxxx>
- References: <200802092352.58848.mr@xxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
This sounds like one of those situations where it would be simpler to just write it.
In your event loop:
def GetInput():
keystate = pygame.key.get_pressed()
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit(); sys.exit()
if event.type == KEYDOWN:
if event.key == LEFT: #Move your sprite left.
elif event.key == RIGHT: #Move your sprite right.
elif event.key == UP: #Move your sprite up.
elif event.key == DOWN: #Move your sprite down.
else: #Make a new sprite.
Or something.
Hope this helps.
Ian