Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improved smoke effect, reverted to old explosion

  • Loading branch information...
commit 780325e3289f8913e049e5198b8ee68d1abf02b6 1 parent d408ef2
michael authored
View
BIN  images/smoke.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
17 sources/enemy.py
@@ -156,10 +156,10 @@ def processHit(self,laserlist, ship):
if self.life<=0:
self.dying=True
if self.typeofship==0:
- particles.addExplosion(self.x, self.y, 2)
+ #particles.addExplosion(self.x, self.y, 2)
self.menu.play_sound(self.sounds['explosion.wav'])
else:
- particles.addExplosion(self.x, self.y, 1)
+ #particles.addExplosion(self.x, self.y, 1)
self.menu.play_sound(self.sounds['explosion2.wav'])
Enemy.nbAsteroids=Enemy.nbAsteroids-1
print("dying")
@@ -193,7 +193,7 @@ def processHit(self,laserlist, ship):
if self.life<=0:
self.dying=True
ship.score=ship.score+10
- particles.addExplosion(self.x, self.y, 2)
+ #particles.addExplosion(self.x, self.y, 2)
self.menu.play_sound(self.sounds['explosion.wav'])
else:
self.shot=30
@@ -202,7 +202,7 @@ def processHit(self,laserlist, ship):
elif self.typeofship==1:
self.dying = True
ship.score=ship.score+10
- particles.addExplosion(self.x, self.y, 1)
+ #particles.addExplosion(self.x, self.y, 1)
self.menu.play_sound(self.sounds['explosion2.wav'])
#print("dying")
Enemy.nbAsteroids=Enemy.nbAsteroids-1
@@ -212,7 +212,7 @@ def processHit(self,laserlist, ship):
if self.life<=0:
self.dying=True
ship.score=ship.score+10
- particles.addExplosion(self.x, self.y, 3)
+ #particles.addExplosion(self.x, self.y, 3)
self.menu.play_sound(self.sounds['explosion.wav'])
else:
self.shot=30
@@ -245,6 +245,10 @@ def update(self, ship):
# self.alive = False
elif self.alive:
+ #if we don't have max live, smoke is going out
+ if self.life!=100 and self.compteurx%5==0:
+ smoke.addSmoke(self.x,self.y, 25)
+
#if we are being shot, there is alternate blitting for one second
if self.shot>0:
#explosion
@@ -260,9 +264,6 @@ def update(self, ship):
#if self.typeofship==2:
#self.screen.blit(self.sprite_enemy, (self.x, self.y))
- if self.shot%7==0:
- smoke.addSmoke(self.x,self.y)
-
else:
if self.typeofship==0:
self.screen.blit(self.single_sprites['sprite_enemy_fire.png'], (self.x, self.y-15))
View
11 sources/smoke.py
@@ -10,9 +10,11 @@
smokes = list()
#size : 1 : asteroids, 2: ships, 3: boss
-def addSmoke ( x, y):
+def addSmoke ( x, y, size):
#appending the smoke particle, and his current life (300
- smokes.append((x,y,256, 45))
+ #size = random.randint(10,45)
+ #size=45
+ smokes.append((x,y,256, size))
def determine_smoke(k):
@@ -31,12 +33,11 @@ def blitAndUpdate():
(x, y, life, size) = smokes[i]
life = life -1
- if size > 0 and life%2==0:
+ if size > 0 and life%8==0:
size=size-1
-
#print("size", size)
toblit = pygame.transform.scale(single_sprites['smoke.png'],( size, size))
- screen.blit(toblit, (x-(45-size),y-(45-size)))
+ screen.blit(toblit, (x-(25-size),y-(25-size)))
smokes[i]=(x, y, life,size)
Please sign in to comment.
Something went wrong with that request. Please try again.