-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
michael
authored and
michael
committed
Jul 30, 2012
1 parent
dd8abdc
commit d408ef2
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#handles the smoke present at the screen at this time | ||
import random | ||
import common_pygame | ||
import load_resources | ||
|
||
single_sprites=load_resources.single_sprites | ||
pygame = common_pygame.pygame | ||
screen= common_pygame.screen | ||
|
||
smokes = list() | ||
|
||
#size : 1 : asteroids, 2: ships, 3: boss | ||
def addSmoke ( x, y): | ||
#appending the smoke particle, and his current life (300 | ||
smokes.append((x,y,256, 45)) | ||
|
||
|
||
def determine_smoke(k): | ||
(x, y, life, size) = k | ||
#print("life:", life) | ||
if life >= 0: | ||
return True | ||
return False | ||
|
||
def blitAndUpdate(): | ||
for i in range(len(smokes)): | ||
#delete the particles that are too old | ||
smokes[:]=[k for k in smokes if determine_smoke(k)] | ||
for i in range(len(smokes)): | ||
#blit the concerned particle | ||
(x, y, life, size) = smokes[i] | ||
life = life -1 | ||
|
||
if size > 0 and life%2==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))) | ||
|
||
smokes[i]=(x, y, life,size) | ||
|