• ccc 设置图片位置


    cc.Class({
        extends: cc.Component,
    
        properties: {
            player:{
                default:null,
                type:cc.Sprite
            }
        },
    
        // use this for initialization
        onLoad: function () {
            var self=this
            
            cc.eventManager.addListener({
                event: cc.EventListener.TOUCH_ONE_BY_ONE,
    
                //开始
                onTouchBegan: function(touch, event) {
                    
                    
                    var pos=touch.getLocation()
                    pos.x-=480
                    pos.y-=320
                    self.player.node.position=pos
                    return true; // don't capture event
                },
    
                //移动
                onTouchMoved: function(touch, event) {
                    var pos=touch.getLocation()
                    pos.x-=480
                    pos.y-=320
                    self.player.node.position=pos
                },
                
                //结束
                onTouchEnded: function(touch, event) {
                    console.log("end")
                }
            }, self.node);
        },
    
        // called every frame, uncomment this function to activate update callback
        // update: function (dt) {
    
        // },
    });
    
    
  • 相关阅读:
    PHP入门
    bootstrap框架
    jsp5 include forward param
    jsp4 Cookie
    网页定位导航
    jsp3 javabean
    Obsidian md安装闪退
    Excel 2016 Mac VBA 的变化 窗体消失
    Excel Mac 2016 调用 Applescript
    如何自学R
  • 原文地址:https://www.cnblogs.com/yufenghou/p/5431597.html
Copyright © 2020-2023  润新知