[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Drawing Bullets



Well, bullets just seem to be a sticking point for me. Just when I think I have code that'll work, I get hit with another problem. This time, I get almost done. There is a bullet class, that adds 50 bullets to a bullet container array, and then fires them. Or, rather, it should fire them. But you know how things are. Just because they should doesn't mean they do. ;)

Now, it's not so much the coding of the bullet formulas and stuff, I got that down-packed (I think). The only thing left now is two things:

1. bullet cleanup (self.kill, etc.) which isn't important to me right now, as the demo won't be running for an extended period, and when it does it'll be running on a monstrous beast of a computer that can probably handle the crappy coding.
2. Drawing bullets (pygame.update.dirtyrects, etc) which is VERY important to me right now.

So, I tried to load an image for the bullets, and that didn't work either. What happened was that it couldn't load the image... probably because it doesn't exist. Which it does, though.

It's in the project directory under the folder img/Bullet.png. When I put img/Bullet.png into the load_image function it says it can't load the image! I tried it with front and back slashes and it didn't work.


After I get the image loaded, however, I can't add the bulletlist to my list of dirtyrects to update... The dirtyrect doesn't read from lists! How do I get pygame.sprite.RenderUpdates to display my bullets on the screen?