[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] Re: Unpunch
Pete Shinners Wrote:
> the problem is likely the foolish logic already
> built into the
> Fist.punch() function..
>
> def punch(self, target):
> "returns true if the fist collides with the
> target"
> if not self.punching:
> self.punching = 1
> hitbox = self.rect.inflate(-5, -5)
> return hitbox.colliderect(target.rect)
>
> this manages a variable named self.punching too keep
> the fist from
> punching more than once. you need to call the
> Fist.unpunch() method
> when the mouse is released.
>
> other than that you code to check for punches
> against all the elves
> looks perfect. i suspect it's something in this fist
> punch code.
Calling the unpunch method was helpful but the other
elves are only punchable in the area the first one was
hit. I suspect that this has something to do with
hitbox that is made up in the fist.punch method, but i
tried deleting it but it doesn't solve the problem.
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