/usr/lib/games/solarwolf/objsmoke.py is in solarwolf 1.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #explosion class
import random, math
import pygame
from pygame.locals import *
import game, gfx
images = []
def load_game_resources():
global images
images = gfx.animstrip(gfx.load('smoke.png'))
if gfx.surface.get_bytesize()>1: #16 or 32bit
i = 1
for img in images:
img.set_alpha((1.8-math.log(i))*40, RLEACCEL)
i += 1
class Smoke:
def __init__(self, pos):
self.clocks = 0
self.rect = images[0].get_rect()
self.rect.center = pos
offset = random.randint(-7,7), random.randint(-7,7)
self.rect = self.rect.move(offset)
self.lastrect = self.rect
self.dead = 0
self.drift = random.randint(-1, 1), random.randint(-1, 1)
self.speed = random.randint(2, 4)
self.current = 0
self.life = random.randint(12, 20)
def erase(self, background):
r = background(self.rect)
if self.dead:
gfx.dirty(r.inflate(1, 2))
def draw(self, gfx):
frame = min(self.clocks / 5, 3)
img = images[frame]
r = gfx.surface.blit(img, self.rect)
gfx.dirty(r.inflate(1, 2))
def tick(self, speedadjust):
self.current += 1
if self.current >= self.speed:
self.current = 0
self.rect = self.rect.move(self.drift)
self.clocks += 1
if self.clocks >= self.life:
self.dead = 1
|