Cocos2d-html5学习笔记二

从Cocos2d-html5 v2.1.5升级到v2.2的时候,有一部分API发生变化,使用起来更加方便了:

1. 几何

1 cc.RectMake, cc.SizeMake, cc.PointMake

均被弃用,取而代之的是下面的几个方法:

1 cc.rect(), cc.size(), cc.p()

2. 原来注册事件分发器代理(dispatcher delegate)的方法被转为私有,同时直接在cc下提供了快捷方法。

1 cc.Director.getInstance().getTouchDispatcher().addTargetedDelegate() 
2 cc.Director.getInstance().getTouchDispatcher().addStandardDelegate()
3 cc.Director.getInstance().getTouchDispatcher().removeDelegate()

更改为:

1 cc.registerTargetedDelegate() 
2 cc.registerStandardDelegate()
3 cc.unregisterTouchDelegate()

3. 粒子系统中的cc.ParticleSystemQuad被合并到cc.ParticleSystem:

1 cc.ParticleSystemQuad.create(); -> cc.ParticleSystem.create();

还有其它的一些更改,详情见cocos2d-html5官网

原文地址:https://www.cnblogs.com/jsxh/p/3495035.html