下面一段代码是一个选择在行走动画当前帧使用的函数。在这里使用两幅图像,
这样程序可以让玩家在移动时看起来像在走路的样子。为了这么做,程序使用了
count变量,并根据它的值,返回动画中两幅图像中的一幅
def move( image1,image2 ) :
global count
if count < 5 :
image = image1
elif count >=5:
image =image2
if count >= 10
count = 0
else :
count += 1
return image