954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

pygame ammo array help/pointer to help

i am making a 2d side scroller and have got the enemy's and the player and the controls all working but i am trying to make a array of my ammo class for the enemy class to use, i have made 10 separate enemy's and i made 10 separate ammo for the player class to use but i am sure there is a easier way to do this then make 50 sprites of the ammo class and test each one when i am checking for one that has not been fired yet and keeping track of each individual ammo sprite.

any advice or pointers to form similar to this would be very much appreciated!

Daocsm
Newbie Poster
5 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

never mind i figured it out, apparently you can add as many sprites as you want to a group with the same name, so i just use the group.add(classname) function and i don't even need to initialize it before i add it into the group. wish i figured this out before i did it the hard way oh well.

Daocsm
Newbie Poster
5 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

Please mark solved. Thanks.

SgtMe
Nearly a Posting Virtuoso
1,205 posts since Oct 2009
Reputation Points: 68
Solved Threads: 85
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You