zoukankan      html  css  js  c++  java
  • 游戏开发-cocos creator踩坑-1.X版本引擎升级2.X后函数替换的问题

    1、向量相减  cc.pSub(vec1, vec2) ---> vec1.sub(vec2)

    2、cc.DrawNode、this.draw_node.drawSegment ---> cc.Graphics

      API    https://blog.csdn.net/qq_37849776/article/details/79528552

    // 画线段
    //1.x代码
    this.draw_node = new cc.DrawNode();
    this.node._sgNode.addChild(this.draw_node);
    
    this.draw_node.drawSegment(cc.v2(xpos, ypos),
        cc.v2(xpos + 1, ypos + 1),
        1, cc.color(0, 255, 0, 255));
    
    // 2.x 废弃了cc.DrawNode 采用cc.Graphics
    this.new_draw_node = newNode.getComponent(cc.Graphics);
    if (!this.new_draw_node) {
        this.new_draw_node = this.node.addComponent(cc.Graphics);
    }
    
    this.new_draw_node.clear(); // 清除以前的
    
    this.new_draw_node.moveTo(xpos, ypos);
    this.new_draw_node.lineTo(xpos + 1, ypos + 1);
    this.new_draw_node.stroke();

    3、返回该向量的长度 cc.pLength(vec1) --->  vec1.mag()

    4、创建一个vector2向量cc.p(x, y) ---> cc.v2(x, y)

    5、修改深度setLocalZOrder ---> node.zIndex = number 值越小越靠前

    -------------------------- Editor

    1、项目路径 Editor.projectPath ---->  Editor.Project.path

  • 相关阅读:
    Mysql 库表
    Mysql (二)
    SQLAlchemy
    Mysql 测试题
    jquery
    抽屉 演示
    前端项目
    JavaScript
    Html Css  练习
    Pandas之DataFrame——Part 3
  • 原文地址:https://www.cnblogs.com/orxx/p/10552651.html
Copyright © 2011-2022 走看看