[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Firing bullets
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Firing bullets
- From: "andrew baker" <failrate@xxxxxxxxx>
- Date: Wed, 28 Mar 2007 23:27:50 -0700
- Delivered-to: email@example.com
- Delivered-to: firstname.lastname@example.org
- Delivered-to: email@example.com
- Delivery-date: Thu, 29 Mar 2007 02:27:59 -0400
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=otTfeDuJedkfXoKyltVZyo7v/TsXQzPk5gm/misPmO1tJ6fs5A5ka7+YVDIB0s0jj/0HYEzkuiGp4TRzcgNy7BQATeHp2dWFxfG5Q+JkBOQSe58YtsYWg/eySYwS1zWWLNZ+NWvgBU758tjTFiyz65heD6xvuDUw7I9s7gavNYY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=NpIhRsBgVKzSZlnoGXD1O3Q4gbjhTlQaurtN8/DuIsGnwXE+OBN3yPwhiH9aCEY6HO6P9sKvh9LIKWuQm7nH8OIi3L+h8V83JJstUyIOMkSN6pb1A5GvkqF6Y6LrMURgAUkP8XAexHQX3wJ9FLrFYeQbeY5Eh1Oiui47pcrWhPY=
- In-reply-to: <Pine.BSO.firstname.lastname@example.org>
- References: <email@example.com> <Pine.BSO.firstname.lastname@example.org>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
I always like to fill a list full of bullet sprites to pull from when
a character is firing and to return to when they are "dead". This
saves a lot of processing power, because you are performing less
instantiation and destruction. The trade-off is in memory, but this
shouldn't be significant. The only other thing I would mention is to
make sure that the bullets in the bullet sprite queue are not calling
their update, as they are inactive until fired.
On 3/28/07, Damien Miller <djm@xxxxxxxxxxx> wrote:
On Mon, 26 Mar 2007, Charles Christie wrote:
> Well, I'm trying to get my program to fire bullets now. Isn't that great?
> I think I'm doing it all wrong though...
> My problem has been that I don't know how to make the program fire bullets.
> But then I thought, "shouldn't the character be firing the bullets, not the
> program?" and it's then that I realized why I couldn't do anything. My logic
> has been completely wrong. Again. Go figure <_<
> Well, I still don't have images for characters yet and I still have no
> movement code (I should probably work on that, huh?) but everything else
> aside from the characters and bullets is done.
A few years ago I wrote some classes for an unfinished game that handled
guns and bullets. You might find them useful.
See gun.py in the distribution. It includes a basic damage system and
XML schema to describe models. It is nowhere near as capable as BulletML
(which looks amazing cool) but it is very simple and easy to understand.
The game runs, but lacks sound levels, boss logic and lighting effects.
It requires PyOpenGL.
Andrew Ulysses Baker