Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Aguiar <alanjas@hotmail.com>2012-05-26 23:17:33 (GMT)
committer Alan Aguiar <alanjas@hotmail.com>2012-05-26 23:17:33 (GMT)
commit49025dc69c76efc15fb21d190d65fde754ab0050 (patch)
treee8c002c05f598246aeb1690d4c93d1fef99d4e04
parent46f650e48ad41f64045bb83a2f407e165471d711 (diff)
fix error and change keys
-rwxr-xr-xsprayplay.py62
1 files changed, 29 insertions, 33 deletions
diff --git a/sprayplay.py b/sprayplay.py
index 2315750..e4ea7f1 100755
--- a/sprayplay.py
+++ b/sprayplay.py
@@ -506,7 +506,7 @@ class Player(pygame.sprite.Sprite):
self.reloaded = 1
self.reloadTimer = 0
#self.ammoList = []
- self.ammo = 0 #reset below...
+ #self.ammo = 0 #reset below...
self.generateStoredBulletPositions()
def makeTrophyCase(self):
@@ -573,18 +573,17 @@ class Player(pygame.sprite.Sprite):
self.dtheta = -ROTATION_SPEED
def collectBall(self,bullet):
- self.ammo += 1
bullet.noUpdate = 1
self.ammoList.add(bullet)
def hasAmmo(self):
- if self.ammo > 0:
- #print self.ammo, len(self.ammoList.sprites())
+ if len(self.ammoList.sprites()) > 0:
returnbullet = self.ammoList.sprites()[0]
returnbullet.kill()
- return returnbullet#self.ammoList.sprites()[0]
- else: return 0
+ return returnbullet
+ else:
+ return 0
def genPucks(puckTemplates):
myBuf = []
@@ -728,12 +727,9 @@ class SprayPlay():
gtk.main_iteration()
for evt in pygame.event.get():
- print 'tipo ev: ', evt.type
- print pygame.event.event_name(evt.type)
if evt.type == pygame.QUIT:
raise StopGame
elif evt.type == pygame.KEYDOWN:
- print 'tecla presionda'
if not overlay.dying:
overlay.dying = 1
keyboard_intro.kill()
@@ -742,44 +738,44 @@ class SprayPlay():
if evt.key == pygame.K_ESCAPE:
raise StopGame
if evt.key == pygame.K_RIGHT:
- a.turnRight = 1
- a.isHuman = 1
- if evt.key == pygame.K_LEFT:
- a.turnLeft = 1
- a.isHuman = 1
- if evt.key == pygame.K_RETURN:
- a.shootButton = 1
- a.isHuman = 1
- overlay.kill()
- if evt.key == pygame.K_d:
b.turnRight = 1
b.isHuman = 1
- if evt.key == pygame.K_a:
+ if evt.key == pygame.K_LEFT:
b.turnLeft = 1
b.isHuman = 1
- if evt.key == pygame.K_SPACE:
+ if evt.key == pygame.K_RETURN:
b.shootButton = 1
b.isHuman = 1
- elif evt.type == pygame.KEYUP:
- if evt.key == pygame.K_RIGHT:
- a.turnRight = 0
+ overlay.kill()
+ if evt.key == pygame.K_d:
+ a.turnRight = 1
a.isHuman = 1
- if evt.key == pygame.K_LEFT:
- a.turnLeft = 0
+ if evt.key == pygame.K_a:
+ a.turnLeft = 1
a.isHuman = 1
- if evt.key == pygame.K_RETURN:
- a.shootButton = 0
+ if evt.key == pygame.K_SPACE:
+ a.shootButton = 1
a.isHuman = 1
- if evt.key == pygame.K_d:
+ elif evt.type == pygame.KEYUP:
+ if evt.key == pygame.K_RIGHT:
b.turnRight = 0
b.isHuman = 1
- if evt.key == pygame.K_a:
+ if evt.key == pygame.K_LEFT:
b.turnLeft = 0
b.isHuman = 1
- if evt.key == pygame.K_SPACE:
+ if evt.key == pygame.K_RETURN:
b.shootButton = 0
b.isHuman = 1
- elif event.type == pygame.VIDEORESIZE:
+ if evt.key == pygame.K_d:
+ a.turnRight = 0
+ a.isHuman = 1
+ if evt.key == pygame.K_a:
+ a.turnLeft = 0
+ a.isHuman = 1
+ if evt.key == pygame.K_SPACE:
+ a.shootButton = 0
+ a.isHuman = 1
+ elif evt.type == pygame.VIDEORESIZE:
pygame.display.set_mode(event.size, pygame.RESIZABLE)
if not a.isHuman:
@@ -810,7 +806,7 @@ class SprayPlay():
x = player.rect.center[0] + cosx * PLAYER_ARM_LENGTH
y = player.rect.center[1] + sinx * PLAYER_ARM_LENGTH
Bullet( (x,y),bulletDir )
- player.ammo -= 1
+ #player.ammo -= 1
player.reloaded = 0
player.reloadTimer = int((1.0 + RELOAD_RANDOM*2*(random.random()-.5))*RELOAD_DELAY)
if not player.reloaded: