XNA 学习笔记2

来源:互联网 发布:手机个人热点软件 编辑:程序博客网 时间:2024/05/16 09:53

如何显示动态图片

使用draw之中的第三个参数,截取显示的图片,通过设定展示大小,来进行展示

 spriteBatch.Draw(one, currentV,new  Rectangle(Currentframe.X*frameSize.X,Currentframe.Y*frameSize.Y,frameSize.X,frameSize.Y), Color.White, 0, Vector2.Zero,1,SpriteEffects.None, 0.5f);

然后再update之中更新Currentframe,就可以实现动画的播放了。

本质上是,更新Currentframe,引起draw截取的位置发生改变,然后将图像回话出来。

调整动画速度
        全局  帧素,60fps(默认)

TargetElapsedTime = new TimeSpan(0,0,0,0,50);

draw和update之中有gameTime参数的IsRunningSlowly判断是否跟不上显示速度。

物体 帧速

经过变量检测,只有满足条件时才触发。

0 0
原创粉丝点击