无限循环背景ParallaxNode
2016-02-16 13:16
561 查看
无限循环背景
void ParallaxNode::incrementoffset(Point offset, Node* node) { for (unsigned int i = 0; i < _parallaxArray->num; ++i) { PointObject* point = (PointObject*)_parallaxArray->arr[i]; Node* curNode = point->getChild(); if (curNode == node) { point->setOffset(point->getOffset()+ offset); } } }每移动一完就incrementoffset
function InfiniteBg:update(dt) for k,bg in pairs(self.bgs) do local p = cc.p(bg:getPosition()) local width = bg:getContentSize().width; p = self:convertToWorldSpace(p) if (p.x < -width) then print("[InfiniteBg] : repeat bg") self:incrementoffset(cc.p(width,0),bg); end end end
相关文章推荐
- windows 使用Node.js安装【IONIC】
- nodejs使用记录
- 《node开发指南》源码之express4、mongoose、ejs
- 快速掌握Node.js环境的安装与运行方法
- 解析Node.js基于模块和包的代码部署方式
- 详解Node.js包的工程目录与NPM包管理器的使用
- Node.js本地文件操作之文件拷贝与目录遍历的方法
- 使用Node.js处理前端代码文件的编码问题
- 剖析Node.js异步编程中的回调与代码设计模式
- 解析Node.js异常处理中domain模块的使用方法
- hadoop-2.6.2 namenode resourcemanager ha 环境搭建
- Leetcode -Delete Node in a Linked List !
- 用nodejs库cheerio抓取网页内容与图片
- 前端工程师使用node.js打造日记社区教程之四
- node.js的一个简单框架
- 使用基于Node.js的构建工具Grunt来发布ASP.NET MVC项目
- 安装并试用nodejs
- Node.js简单使用
- Light OJ 1257 Farthest Nodes in a Tree (II) (树形DP)
- NodeJS获取命令行后面的参数