python - Making a walking effect with kivy -
this first time on stack overflow , hoping help.
i new kivy , love build game temple run kivy, have idea how, problem making avatar have running effect. thinking use gif image, did not work.
please on how animate avatar.
i made game had many .png files wanted animate explosion. put .png files .zip file , did following:
explosion = explosion( size_hint=(none, none), source='explosion.zip', anim_delay=0, allow_stretch=true, keep_ratio=false)
where explosion
this:
class explosion(image): pass
while various keyword arguments not relevant you, take note of source
, , maybe also, anim_delay
args. me, making 0 made there smooth animation, different gif.
from image docs:
anim_delay
delay animation if image sequenced (like animated gif). if anim_delay set -1, animation stopped.
anim_delay numericproperty , defaults 0.25 (4 fps).
it's been while since made game, here snippet earlier in code:
def __init__(self, **kw): super(mygame, self).__init__(**kw) # pre-load zipped pngs using keep_data avoid delays later load_zipped_png_files = image( source = 'explosion.zip', anim_delay = 0, allow_stretch = true, keep_ratio = false, keep_data = true)
i believe have effect of keeping zipped .png files in memory thereby avoiding delays in loading them later on. may not having desired effect, can't remember honest, however, remember thinking did! recommend testing out if go route. , please let me know if works out.
Comments
Post a Comment