九月28的项目
来源:互联网 发布:淘宝发货员累吗 编辑:程序博客网 时间:2024/04/30 21:52
flabby_bird
地板运动逻辑:
1. 两个底板都以每0.05秒香左5像素移动,即:
ground.x +=move_speed:
2一旦某一底板离开屏幕显示范围,就将其位置立即放到另一地板后
帧动画循环
图片规律123456
放置规律1234565432完成循环
地板向下移动代码
cc.Class({
extends: cc.Component,
properties: {
//地板的移动速度
move_speed: -5,
//地板移动的时间间隔
move_interval: 0.05,
// 地板节点数组
groundNode: {
default: [],
type: [cc.Node]
},
// 地板图片对象
groundImg: {
default: null,
type: cc.Sprite
},
},
// use this for initialization
onLoad: function () {
// 获取屏幕尺寸
this._size = cc.winSize;
// 获取地板图片的宽度
this._height = this.groundImg.spriteFrame.getRect().height;
// 启动“地板移动控制”计时器
this.schedule(this.onGroundMove, this.move_interval);
},
onGroundMove: function() {
this.groundNode[0].y += this.move_speed;
this.groundNode[1].y += this.move_speed;
if (this.groundNode[0].y + this._height/2 < - this._size.height/2) {
this.groundNode[0].y = this.groundNode[1].y + this._height - 16;
}
if (this.groundNode[1].y + this._height/2 < - this._size.height/2) {
this.groundNode[1].y = this.groundNode[0].y + this._height - 16;
}
},
地板运动逻辑:
1. 两个底板都以每0.05秒香左5像素移动,即:
ground.x +=move_speed:
2一旦某一底板离开屏幕显示范围,就将其位置立即放到另一地板后
帧动画循环
图片规律123456
放置规律1234565432完成循环
地板向下移动代码
cc.Class({
extends: cc.Component,
properties: {
//地板的移动速度
move_speed: -5,
//地板移动的时间间隔
move_interval: 0.05,
// 地板节点数组
groundNode: {
default: [],
type: [cc.Node]
},
// 地板图片对象
groundImg: {
default: null,
type: cc.Sprite
},
},
// use this for initialization
onLoad: function () {
// 获取屏幕尺寸
this._size = cc.winSize;
// 获取地板图片的宽度
this._height = this.groundImg.spriteFrame.getRect().height;
// 启动“地板移动控制”计时器
this.schedule(this.onGroundMove, this.move_interval);
},
onGroundMove: function() {
this.groundNode[0].y += this.move_speed;
this.groundNode[1].y += this.move_speed;
if (this.groundNode[0].y + this._height/2 < - this._size.height/2) {
this.groundNode[0].y = this.groundNode[1].y + this._height - 16;
}
if (this.groundNode[1].y + this._height/2 < - this._size.height/2) {
this.groundNode[1].y = this.groundNode[0].y + this._height - 16;
}
},
阅读全文
0 0
- 九月28的项目
- 九月最热门的25个开源项目
- 九月最热门的25个开源项目
- 九月的幸福~~
- 右手的五七九月
- 九月的天空
- 九月的薄荷香
- 忙碌的九月
- 九月的哈尔滨
- 奔跑的九月!
- BZOJ3308九月的咖啡店
- 九月
- 九月
- 九月
- 九月
- sourceforge列出九月的有趣更新 排名前25位的开源项目出炉
- Information : sourceforge列出九月的有趣更新 排名前25位的开源项目出炉
- sourceforge列出九月的有趣更新 排名前25位的开源项目出炉
- bzoj1483 [HNOI2009]梦幻布丁 (启发式合并 + 链表 )
- Linux安装tomcat
- [bzoj1935][Shoi2007]Tree 园丁的烦恼 树状数组
- 【JQuery】- 省市选择
- 非常好的t-SNE介绍
- 九月28的项目
- Linux开机自启动tomcat
- Linux中两种新建用户命令的区别
- Caffe训练过程:test_iter test_interval等概念
- elasticsearch 核心概念
- js json回车 处理特殊字符,textArea 换行处理
- Java 接口 详解
- python代码:图片鉴黄
- 23种设计模式