[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
No Subject
I am a newbie to Pygame, and my first project was to
modify the chimp program. I have read and understand
how it works but I am confused on one issue. In my
program, I have made several chimp objects, but when I
try to punch them only one of them is able to be hit.
I don't know why this is happening but I would like to
fix it. Somebody help me please. Here are samples of
my code where i think the problem is:
elf1 = Chimp()
elf2 = Chimp()
elf3 = Chimp()
elves = [elf1, elf2, elf3]
crosshairs = Fist()
allsprites=
pygame.sprite.RenderUpdates((crosshairs, elf1, elf2,
elf3))
for elf in elves:
if crosshairs.punch(elf):
punch_sound.play()
elf.punched()
elf.kill()
The rest of the code remains mostly unchanged and can
be viewed at
http://pygame.org/docs/tut/ChimpLineByLine.html if
ther e is any questions.
I have tried a few things,like making multiple if
statement, for each elf(aka. chimp). I have also tried
deleting the hitbox that is created once the elf is
punchd. But the hitbox area remains in the same spot.
And the proram registers a hit every time you click on
the area where you killed the elf. My question is how
can i make the program kill one object then move onto
the next, or how can I make all of the sprites
punchable.
If anyone understands my question/problem please help.
Thanks Max
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org