[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] my rpg game (so far)
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] my rpg game (so far)
- From: Michael Fiano <michael.fiano@xxxxxxxxx>
- Date: Fri, 31 Oct 2008 06:13:15 -0400
- Cc: ndudfield@xxxxxxxxx
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 31 Oct 2008 06:08:23 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=bWJHadDlwKqBIH42JZ9I24QUNRabawhfNp1xBgAu2qc=; b=N1NFf4cf0ySao8doRDrgzUYYCkJ7gd1MS4s8RFNxsLewS9vhgkh2eKszMf9BSJShoQ fVV35UBChrSIMvvXgURjjnewq21LaF9c0VeP8iQBFN1Liie5PziOjz+O4VQEa43vbn9b N9XoSskGxNMkiEwAzypEyzbcNtL6kF5y2UNOQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=b9BK54J0nXFHPuW77FMs9yeUtfM1km9tTLCUfaZ8zyDDlOZBMSbahgKiC0Je+9id+E MDgGNCU1kjIJdF6dv1yzpcBdqQ1RQJ2qwR0EKAGNdYp/3q2fv1M9A1qWhOtRUiIcBy+d 1C6+n9i0vJ+uRB2D5K4c4uCQj329SbrOslAW8=
- In-reply-to: <490AC443.1010606@xxxxxxxxx>
- References: <20081031032209.3c384aad@axdesk> <490AC443.1010606@xxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
On Fri, 31 Oct 2008 18:39:31 +1000
Nicholas Dudfield <ndudfield@xxxxxxxxx> wrote:
> I am pretty sure you don't need to run event.pump() for every event.
>
> It doesn't seem like `keyinput` is being used at all so it's probably
> not needed.
You're right. I don't need it anymore. keyinput was being used before
to make it so that more than one key could be pressed to move the
character. I gave up due to minor bugs in my code and forgot to remove
that little bit. What I would like to do:
Right now if you are holding a directional key to move, and you press a
different directional key at the same time, the player will stop,
instead of changing directions. If anyone could give me some pointers
on how to do this I'd be very happy, because I want it to be
gamepad-friendly too.
> <code>
> elif event.key == K_UP or event.key == K_DOWN or event.key == K_LEFT
> or event.key == K_RIGHT:
> do_stuff()
> </code
>
> The python idiom for this is
>
> <code>
> elif event.key in (K_UP, K_DOWN, K_LEFT, K_RIGHT):
> do_stuff()
> </code>
Aha, nice. Thanks!