OT源代码的分析,OrtHello 迟早攻破你 (六)重要的OTSprite

说了大半天才说到OTSprite ,这才是重点-,-

Sprite 有三种:OTFilledSprite,OTSprite,OTAnimatingSprite

最常用的可能是AnimatingSprite -_- 这跟cocos2d可能有些不同。

先说说Sprite,OTSprite : OTObject   前面几个属性一看就懂了吧,Pivot是中心点位置,Register Input是接收鼠标响应时间,Depth是影响深度(与cocos2d不同的是它不会自动排列,就是说如果你的两个物体在同一深度又刚好重叠的话,你会发现各种不可预知的画面出现-,-),Collidable是碰撞器,下面几个是碰撞器相关,Draggable是可以拖动,Draggable设置为true时Register Input也会设置成true,world bounds是世界坐标限定,Flip 相关的是像素的倒置,Transparent是透明必定要勾上的,


Additive : Boolean (一般不用勾)

Checking this setting will set the material reference to 'additive' ( only works when transparent setting is also checked ) When transparent and additive are checked off, material reference will be set to 'solid'.   

Material Reference   最重要的:材质在这里设置,而不是在下面设置

Tint Color   只有材质是Tint 时才可以使用

Alpha  透明度 1不透明

Image  和 Sprite Container 可以选其中一样来添加

Animation Frameset: String

Set this to the name of a specific frameset from the linked animation that you want to play. If no animation frameset is specified, the combined framesets of the animation object will be played.

Speed:速度因子,1是正常速度,2是双倍,0.5是半速

Looping  是否循环

Number Of Plays  播放多少次,-1是无限次

Play On Start  一开始就动画

Start At Random Frame  随机一帧开始

Destroy When Finished  播放完自动删除

Animation Preview 预览进度,只在编辑器中有效


下面是默认的sprite的设置:

OTSprite : OTObject
{
    public bool _transparent = true;
    public bool _additive = false;
    public string _materialReference = "transparent";
    public Color _tintColor = Color.white;
    public float  _alpha = 1.0f;
    public int _frameIndex = 0;


public class OTAnimatingSprite : OTSprite
{
    public OTAnimation _animation;
    public string _animationFrameset = "";
    public float _speed = 1;
    public bool _looping = true;
    public int _numberOfPlays = -1;
    public bool _playOnStart = true;
    public bool _startAtRandomFrame = false;
    public bool _destroyWhenFinished = false;



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值