/usr/lib/krank/Sprite.py is in krank 0.7+dfsg2-3.
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 | #
# Sprite.py
import k
from Krank import *
from Math import *
#-----------------------------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------
class Sprite (pygame.sprite.Sprite):
images = {}
#-------------------------------------------------------------------------------------------
def __init__(self, pos, image, sprites=None):
pygame.sprite.Sprite.__init__(self)
if image.__class__ == pygame.Surface:
self.image = image
else:
if Sprite.images.get(image) is None:
Sprite.images[image] = pygame.image.load(image)
self.image = Sprite.images[image]
self.rect = self.image.get_rect()
self.setPos(pos)
if sprites <> None:
sprites.add(self)
else:
k.sprites.add(self)
#-------------------------------------------------------------------------------------------
def setPos (self, pos):
try:
self.rect.center = pos
except Exception, e:
self.rect.center = (clamp(pos.x, 0, k.world.rect.width), clamp(pos.y, 0, k.world.rect.height))
|