• 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();
        },
    });
    
    
  • 相关阅读:
    二维码
    struts2 result type=(chain、dispatcher、redirect、redirect-action)
    hibernate bean注解
    js uploadify
    2进制转化成字符串
    server.xml
    html css
    页面乱码
    java class 路径问题
    table th td 宽度
  • 原文地址:https://www.cnblogs.com/yufenghou/p/5448641.html
Copyright © 2020-2023  润新知