I want to do a simple:
if LeftMouseDown(): fire()
But it is failing. Right now both ways I try, it only says the button is
down if the mouse is moving. If I stay at the same x,y coord, it says the
button not pressed(but it is).
# code:
events = pygame.event.get()
for event in events:
# 1) this block doesn't seem to work right unless moving mouse:
(b1,b2,b3) = pygame.mouse.get_pressed()
if b1:
self.player.fire()
print 'down'
#else, tried: 2)
if self.mouse.down:# or True:
self.player.fire()
print 'down'
if event.type == MOUSEMOTION: pass
elif event.type == MOUSEBUTTONDOWN: self.mouse.down = True
elif event.type == MOUSEBUTTONUP: self.mouse.down = False
I'm surprised at method #2 failing, since I never change the value of
mouse.down anywhere else in the code, except those two lines above.
--
Jake