CocosEditor-java 图层问题
来源:互联网 发布:linux下安装weblogic10 编辑:程序博客网 时间:2024/05/21 08:00
如下图,水管应该在后面的,怎么调整遮挡关系呢?
我在设计这个水管时,设计上下两水管是同一个layer,只能同时在Ground面前或者同时在Ground之后。
关键在于Sprite里面的zOrder是没效的,zOrder只对同级Layer的才有效。例如,下面的groundSprite放在bgPlaySrite内,无论你把ground的zOrder设的多大,都不会在柱子前显示。
<?xml version="1.0" encoding="UTF-8"?><Scene designWidth="720" designHeight="1280" positionX="0" positionY="0" anchorPointX="0" anchorPointY="0" sizeType="Percent" width="100" height="100" zorder="-1"> <Layer zorder="0" anchorPointX="0" anchorPointY="0" sizeType="Percent" width="1" height="1" designWidth="720"> <Component name="org.ccj.game.hello.PlayingSceneController" /> <Sprite name="bgPlaySprite"zorder="-1" texture="textures/main.plist/bg.png" positionX="0" positionY="0" anchorPointX="0" anchorPointY="0" designWidth="720" designHeight="1280" sizeType="Percent" rotation="0" width="1" height="1" > <Sprite zorder="10" texture="textures/flappy_packer.plist/bird1.png" positionX="204.5" positionY="747.0" name="playSprite"/> <Sprite name="groundSprite" texture="textures/main.plist/ground.png" anchorPointX="0" anchorPointY="0" positionX="0" positionY="0" zorder="10"/> </Sprite> </Layer></Scene>
解决办法是把groundSprite独立出来,和bgPlaySprite同级,这时,zOrder=“10”就有效了
<?xml version="1.0" encoding="UTF-8"?><Scene designWidth="720" designHeight="1280" positionX="0" positionY="0" anchorPointX="0" anchorPointY="0" sizeType="Percent" width="100" height="100" zorder="-1"> <Layer zorder="0" anchorPointX="0" anchorPointY="0" sizeType="Percent" width="1" height="1" designWidth="720"> <Component name="org.ccj.game.hello.PlayingSceneController" /> <Sprite zorder="-1" texture="textures/main.plist/bg.png" positionX="0" positionY="0" anchorPointX="0" anchorPointY="0" designWidth="720" designHeight="1280" sizeType="Percent" rotation="0" width="1" height="1" name="bgPlaySprite"> <Sprite zorder="10" texture="textures/flappy_packer.plist/bird1.png" positionX="204.5" positionY="747.0" name="playSprite"/> </Sprite> <Sprite name="groundSprite" texture="textures/main.plist/ground.png" anchorPointX="0" anchorPointY="0" positionX="0" positionY="0" zorder="10"/> </Layer></Scene>
0 0
- CocosEditor-java 图层问题
- CocosEditor-java
- CocosEditor-java ListView显示
- CocosEditor-java onContactBegin无反应
- CocosEditor-java 之PolygonShape错误
- CocosEditor-java点击事件出现信息:releassHandler80765691774323352
- CocosEditor-java 切换场景后触摸失灵
- CocosEditor-java开发关键函数汇总【更新中】
- CocosEditor-java写flappyBird的过程记录【更新中】
- CocosEditor java 2.0 alpha1b5 点击图层时,会刷新进入onEnter
- [JAVA][Geotools][添加图层相关的问题
- CocosEditor For Java(Cocos2d-Java) 教程聚合和代码下载
- CocosEditor-java中的android项目传数据给Java项目(NodeReader相关)
- CocosEditor-java导入别人已经用TexturePacker产生的plist文件
- CocosEditor-java加载图片出错cocos2d: fullPathForFilename: No file found at main.plist. Possible missing fi
- CocosEditor-java错误解决cocos2d: the file is not a dds file!
- java service 层的相互调用问题
- cocosEditor错误汇总
- Search a 2D Matrix
- [解题报告]hdoj1285(拓扑排序)
- 方法的参数
- Sort Colors
- Combinations
- CocosEditor-java 图层问题
- 你不是寂寞,你只是不想学习
- 独立运行的程序
- 习题1.18
- Subsets
- 从下一个指数
- MFC中定义全局变量和全局函数的方法
- 轻松上云,从容实施Office 365项目
- ListView中分割线问题