added model loader to anims
This commit is contained in:
parent
3c2b3a9a94
commit
8efc87d502
1 changed files with 12 additions and 3 deletions
15
roc/anims.py
15
roc/anims.py
|
@ -53,6 +53,7 @@ class anim_frameset(object):
|
||||||
|
|
||||||
def load_frames(self, ifn):
|
def load_frames(self, ifn):
|
||||||
ifn, ife = os.path.splitext(ifn)
|
ifn, ife = os.path.splitext(ifn)
|
||||||
|
fnp, fnn = os.path.split(ifn)
|
||||||
if ifn and ifn[-1] == '1':
|
if ifn and ifn[-1] == '1':
|
||||||
self.frames = []
|
self.frames = []
|
||||||
|
|
||||||
|
@ -69,13 +70,17 @@ class anim_frameset(object):
|
||||||
iff = ifn + padnum(i, padlen) + ife
|
iff = ifn + padnum(i, padlen) + ife
|
||||||
if files.mgr.exists(iff):
|
if files.mgr.exists(iff):
|
||||||
#LOAD
|
#LOAD
|
||||||
self.frames += [files.mgr.png(iff)]
|
mdl = models.mgr.create_sprite(fnn, iff)
|
||||||
|
self.frames.append(mdl)
|
||||||
|
#self.frames += [files.mgr.png(iff)]
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
i += 1
|
i += 1
|
||||||
else:
|
else:
|
||||||
#LOAD
|
#LOAD
|
||||||
self.frames = [files.mgr.png(ifn + ife)]
|
mdl = models.mgr.create_sprite(fnn, iff)
|
||||||
|
self.frames.append(mdl)
|
||||||
|
#self.frames = [files.mgr.png(ifn + ife)]
|
||||||
|
|
||||||
if not self.frames:
|
if not self.frames:
|
||||||
raise OSError('File "%s" does not exist' % (ifn + ife))
|
raise OSError('File "%s" does not exist' % (ifn + ife))
|
||||||
|
@ -93,7 +98,7 @@ class anim_frameset(object):
|
||||||
r = self.frames[0].get_rect()
|
r = self.frames[0].get_rect()
|
||||||
return (r.w, r.h)
|
return (r.w, r.h)
|
||||||
|
|
||||||
|
"""
|
||||||
def draw(self, scr, pos, frame):
|
def draw(self, scr, pos, frame):
|
||||||
if scr != self.cached_surface:
|
if scr != self.cached_surface:
|
||||||
for f in self.frames:
|
for f in self.frames:
|
||||||
|
@ -102,3 +107,7 @@ class anim_frameset(object):
|
||||||
|
|
||||||
img = self.frames[frame]
|
img = self.frames[frame]
|
||||||
scr.blit(img, pos)
|
scr.blit(img, pos)
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue