ccc 模拟重力 正太分布
ball.js
cc.Class({
extends: cc.Component,
properties: {
x_vel:{
default:0
},
y_vel:{
default:0
},
grivatity:{
default:null
},
},
onLoad: function () {
this.grivatity=-1;
},
init:function ( x_vel,y_vel) {
this.x_vel=x_vel
this.y_vel=y_vel
},
update: function (dt) {
var now=this.node.position
now.y+=this.y_vel
now.x+=this.x_vel
this.y_vel+=this.grivatity
this.node.position=now
//销毁
if(now.y<-320)
this.node.destroy();
},
});
Muller.js
cc.Class({
extends: cc.Component,
properties: {
x_vel:{
default:0
},
y_vel:{
default:0
},
grivatity:{
default:null
},
},
onLoad: function () {
this.grivatity=-1;
},
init:function ( x_vel,y_vel) {
this.x_vel=x_vel
this.y_vel=y_vel
},
update: function (dt) {
var now=this.node.position
now.y+=this.y_vel
now.x+=this.x_vel
this.y_vel+=this.grivatity
this.node.position=now
//销毁
if(now.y<-320)
this.node.destroy();
},
});
ccc 模拟重力 正太分布的更多相关文章
- ccc 模拟重力
x=x+v v=v+gr cc.Class({ extends: cc.Component, properties: { velocity:{ default:null }, grivatity:{ ...
- R语言绘制正太分布图,并进行正太分布检验
正态分布 判断一样本所代表的背景总体与理论正态分布是否没有显著差异的检验. 方法一概率密度曲线比较法 看样本与正太分布概率密度曲线的拟合程度,R代码如下: #画样本概率密度图s-rnorm(100 ...
- canvas模拟重力效果
总结 速度和加速度是动画的基础元素,其中两者都是向量,包括了一个重要因素:方向. 要学会应用 分解 和 合成 ,将速度或加速度分解到x.y轴上,然后将每条轴上的加速度或速度相加,然后再分别与物体的位置 ...
- Android sample 之模拟重力感应,加速度
class SimulationView extends View implements SensorEventListener { // diameter of the balls in meter ...
- 科学计算 NumPy 与C语言对比 N-dimensional array ndarray 元素元素操作 计算正太分布分位数
w http://www.numpy.org/ NumPy is the fundamental package for scientific computing with Python. It co ...
- 数学建模python matlab 编程(喷泉模拟)
在无风情况下的喷泉模拟 我的python代码 import numpy as np import random import matplotlib matplotlib.rcParams['font. ...
- Cocos2d-x 3.1.1 Lua实例-AccelerometerTest(重力加速计)
Cocos2d-x 3.1.1 Lua实例-AccelerometerTest(重力加速计) 本篇博客介绍Cocos2d-x的第一个实例--重力加速计測试.效果图(注:这里无法模拟重力感应): --[ ...
- T分布
# T分布 # 1.T分布是统计分布的一种,同卡方分布(X2分布),F分布并称为三大分布 2.T分布又叫student-t分布,常用于根据小样本来估计呈正太分布且方差值未知的样本的均值(如果总体的方差 ...
- R代码展示各种统计学分布 | 生物信息学举例
二项分布 | Binomial distribution 泊松分布 | Poisson Distribution 正态分布 | Normal Distribution | Gaussian distr ...
随机推荐
- 比较原声socket 、GCDAsyncSocket
原声socket NSInputStream 输入流(OC)NSOutputStream 输出流(OC)1:通过c语言的输入输出流CFReadStreamRef/CFWirteStreamRef(输入 ...
- c_test
1.int a[][4]={0,0};与int a[3][4] = {0}; 元素不够的就以位模式初始化为0 a[第一维][第二维] 的大小,也就是最多存几个 int a[][3]={1,2,3,4, ...
- strlen与sizeof
strlen计算不包括终止符null字节的字符串长度,而sizeof则计算包括终止null字节的长度.另一个差别,strlen需要一次函数调用,而sizeof在编译时计算缓冲区长度.
- hdu1141(二进制数位,二分,打表)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1141 题意:××公司是制造computer的,1960年它造的computer是4bit的,之后每10 ...
- 三、jQuery--Ajax基础--Ajax全接触--扩展知识(跨域)
- Mex文件在VS2010中调试方法
http://www.cnblogs.com/lukylu/p/4042306.html matlab里面无法单步调试mex函数,故需转到VS上面调试,这里采用VS2010. 参考网上很多人写的方法但 ...
- sql学习笔记--存储过程
存储过程(stored procedure)有时也称sproc,它是真正的脚本,更准确地说,它是批处理(batch),但都不是很确切,它存储与数据库而不是单独的文件中. 存储过程中有输入参数,输出参数 ...
- 从 Eclipse 迁移至 Android Studio
从 Eclipse 迁移至 Android Studio 本文内容 Android Studio 基础知识 迁移先决条件 将项目导入 Android Studio 后续步骤 将项目迁移至 Androi ...
- forEach 方法 (Array) (JavaScript)
为数组中的每个元素执行指定操作. 语法 array1.forEach(callbackfn[, thisArg]) 参数 参数 定义 array1 必选.一个数组对象. callbackfn 必选.最 ...
- 获取Windows下某进程监听的TCP/UDP端口
1.在Windows下用CMD netstat命令可以获得当前进程监听端口号的信息,如netstat -ano可以看到IP.port.状态和监听的PID. 那么可以执行CMD这个进程得到监听的端口号信 ...