当前位置: 首页 > news >正文

襄阳做网站 优帮云网络推广怎么找客户

襄阳做网站 优帮云,网络推广怎么找客户,网站建设行业发展方向,代刷网站怎么做目录 见缝插针UI脚本针脚本球脚本心得_旋转心得_更改父节点心得_缓动动画成品展示图 见缝插针 本人只是看了老师的大纲,中途不明白不会的时候再去看的视频 所以代码可能与老师代码有出入 SIKI_学院_点击跳转 UI脚本 import { _decorator, Camera, color, Component, directo…

目录

  • 见缝插针
    • UI脚本
    • 针脚本
    • 球脚本
    • 心得_旋转
    • 心得_更改父节点
    • 心得_缓动动画
    • 成品展示图

见缝插针

本人只是看了老师的大纲,中途不明白不会的时候再去看的视频
所以代码可能与老师代码有出入
SIKI_学院_点击跳转

UI脚本

import { _decorator, Camera, color, Component, director, instantiate, Label, math, Node, Prefab, tween } from 'cc';
const { ccclass, property } = _decorator;@ccclass('ts_ui')
export class ts_ui extends Component {static inthis : ts_uistatic getinthis() : ts_ui {return this.inthis}@property(Prefab) pin : Prefab = null@property(Node) cam : Node = nullpin_num : number = 0    //  是否生成pin@property(Label) ui_fen : Label = nullfen : number = 0@property(Camera) camera : Camera = null@property(Node) but : Node = nullstart() {ts_ui.inthis = thisthis.schedule(this.on_rate,1)this.on_fen(0)}update(deltaTime: number) {}on_rate(){if (this.pin_num == 1){return}  //  是否生成const p = instantiate(this.pin)this.cam.addChild(p)p.setPosition(0 , -640)this.pin_num = 1}on_fen(num : number){this.fen += numthis.ui_fen.string = this.fen.toString()}on_end(){this.but.active = truethis.on_anim()this.scheduleOnce(function(){director.pause()},1)}on_anim(){  //  结束缓动动画函数let new_col = new math.Color()new_col.r = 60new_col.g = 5new_col.b = 5new_col.a = 255tween(this.camera).to(1 , {orthoHeight : 450 , clearColor : new_col}).start()}on_reset(){director.resume()director.loadScene(`s1`)}
}

针脚本

import { _decorator, Collider2D, Component, Contact2DType, Input, input, Node } from 'cc';
import { ts_circle } from './ts_circle';
import { ts_ui } from './ts_ui';
const { ccclass, property } = _decorator;@ccclass('ts_pin_s')
export class ts_pin_s extends Component {move_sp : number = -2   //  -2刚生成时 -1等待发射 0发射 1完成碰撞start() {const col = this.getComponent(Collider2D)if (col){col.on(Contact2DType.BEGIN_CONTACT,this.on_bc,this)}   //  开启碰撞else {console.log(`针头 开启碰撞异常`)}input.on(Input.EventType.TOUCH_END , this.on_te , this)     //  开启触摸}on_bc (me : Collider2D , oth : Collider2D){console.log(`针头碰撞`,oth.name)if (oth.name == `Circle<CircleCollider2D>`){const pw = this.node.getWorldPosition()const rw = this.node.getWorldRotation()const cir = ts_circle.getinthis()this.node.setParent(cir.node)       //  更新父节点this.node.setWorldPosition(pw)this.node.setWorldRotation(rw)this.move_sp = 1const ui = ts_ui.getinthis()ui.pin_num = 0ui.on_fen(1)}if (oth.name == `Pin<BoxCollider2D>`){ts_ui.getinthis().on_end()}}on_te(){if (this.move_sp == -1){this.move_sp = 0}}update(deltaTime: number) {this.move(deltaTime)}move(deltaTime: number){if (this.move_sp >= 1){return}const pos = this.node.getPosition()if (this.move_sp == -2){if (pos.y <= -500){this.node.setPosition(pos.x , pos.y + deltaTime * 500)}      //  新生成速度else {this.move_sp = -1}}if (this.move_sp == -1){return}if (this.move_sp == 0){this.node.setPosition(pos.x , pos.y + deltaTime * 1000)}      //  发射速度}
}

move 函数处于性能考虑
应该在条件判断成立时 返回的,不应该多个IF轮流判定

球脚本

import { _decorator, CircleCollider2D, Collider2D, Component, Contact2DType, Input, Node } from 'cc';
const { ccclass, property } = _decorator;@ccclass('ts_circle')
export class ts_circle extends Component {static inthis : ts_circlestatic getinthis() : ts_circle {return this.inthis}start() {ts_circle.inthis = thisconst col = this.getComponent(Collider2D)if (col){col.on(Contact2DType.BEGIN_CONTACT,this.on_bc,this)}else {console.log(`球 开启碰撞异常`)}}on_bc(me : Node , oth : Node){console.log(`球 碰撞` , oth.name)}update(deltaTime: number) {this.node.angle += 2if (this.node.angle >= 360){this.node.angle = 0}}
}

心得_旋转

在这里插入图片描述
项目设置 > 功能裁剪 > 2D物理系统 > 内置2D物理系统
在不改内置的情况下

this.node.angle += 2    //  旋转角度速度

球旋转会卡住不动,取消刚体组件也可以使其正常旋转,但碰撞就会有点麻烦

心得_更改父节点

在变更父节点的时候,子节点的位置和角度会被重置
不想重置,就需要记录之前的位置和角度,更换后再设置回来

        if (oth.name == `Circle<CircleCollider2D>`){const pw = this.node.getWorldPosition()const rw = this.node.getWorldRotation()const cir = ts_circle.getinthis()this.node.setParent(cir.node)       //  更新父节点this.node.setWorldPosition(pw)this.node.setWorldRotation(rw)this.move_sp = 1const ui = ts_ui.getinthis()ui.pin_num = 0ui.on_fen(1)}

心得_缓动动画

还没有仔细研究,看了老师的视频,依葫芦画瓢
但看使用情况来看,以下是个人理解
tween 传入缓动组件
to 传入 1缓动执行时间 2组件需要缓动变更的属性
start 开始

    on_anim(){  //  结束缓动动画函数let new_col = new math.Color()new_col.r = 60new_col.g = 5new_col.b = 5new_col.a = 255tween(this.camera).to(1 , {orthoHeight : 450 , clearColor : new_col}).start()}

成品展示图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


文章转载自:
http://tennysonian.c7617.cn
http://myograph.c7617.cn
http://oeillade.c7617.cn
http://overconfidence.c7617.cn
http://zestful.c7617.cn
http://diphenylacetylene.c7617.cn
http://effectivity.c7617.cn
http://testacean.c7617.cn
http://judo.c7617.cn
http://toponomy.c7617.cn
http://location.c7617.cn
http://concatenate.c7617.cn
http://maracaibo.c7617.cn
http://mediaman.c7617.cn
http://micronucleus.c7617.cn
http://harmonometer.c7617.cn
http://meiosis.c7617.cn
http://sarcogenic.c7617.cn
http://chastiser.c7617.cn
http://tetraphonic.c7617.cn
http://herbartian.c7617.cn
http://fluorimetric.c7617.cn
http://nwt.c7617.cn
http://acth.c7617.cn
http://timothy.c7617.cn
http://venireman.c7617.cn
http://reverberant.c7617.cn
http://hawsehole.c7617.cn
http://relaxant.c7617.cn
http://parvus.c7617.cn
http://geophone.c7617.cn
http://fogfruit.c7617.cn
http://prescriptive.c7617.cn
http://avid.c7617.cn
http://aiglet.c7617.cn
http://quadricycle.c7617.cn
http://solanaceous.c7617.cn
http://manama.c7617.cn
http://pyretic.c7617.cn
http://piraeus.c7617.cn
http://vibrato.c7617.cn
http://reubenite.c7617.cn
http://tuberculin.c7617.cn
http://discernible.c7617.cn
http://hepaticoenterostomy.c7617.cn
http://swimmable.c7617.cn
http://stab.c7617.cn
http://graveclothes.c7617.cn
http://thymol.c7617.cn
http://swell.c7617.cn
http://lactose.c7617.cn
http://chela.c7617.cn
http://revisionary.c7617.cn
http://reestablishment.c7617.cn
http://teeth.c7617.cn
http://burnable.c7617.cn
http://overstrict.c7617.cn
http://polyphagy.c7617.cn
http://depredate.c7617.cn
http://cricoid.c7617.cn
http://zoophytologist.c7617.cn
http://banderol.c7617.cn
http://homostyly.c7617.cn
http://chloasma.c7617.cn
http://scintillation.c7617.cn
http://haroseth.c7617.cn
http://rice.c7617.cn
http://junkyard.c7617.cn
http://deciare.c7617.cn
http://fondu.c7617.cn
http://blaw.c7617.cn
http://distent.c7617.cn
http://soil.c7617.cn
http://cytochemistry.c7617.cn
http://milometer.c7617.cn
http://constative.c7617.cn
http://ade.c7617.cn
http://geomechanics.c7617.cn
http://insipidness.c7617.cn
http://credendum.c7617.cn
http://simplex.c7617.cn
http://siluroid.c7617.cn
http://qoran.c7617.cn
http://ghastful.c7617.cn
http://corollar.c7617.cn
http://rustication.c7617.cn
http://triangular.c7617.cn
http://romantic.c7617.cn
http://polyglot.c7617.cn
http://diversification.c7617.cn
http://percurrent.c7617.cn
http://airplay.c7617.cn
http://unchurch.c7617.cn
http://kirovabad.c7617.cn
http://unsuited.c7617.cn
http://wetproof.c7617.cn
http://undeniable.c7617.cn
http://centrosphere.c7617.cn
http://structurally.c7617.cn
http://mumbletypeg.c7617.cn
http://www.zhongyajixie.com/news/81201.html

相关文章:

  • 建设公司网站建设网络营销的概念和特点是什么
  • 旅游局网站建设解决方案google搜索网址
  • 甘肃省住房和城乡建设部网站首页seo搜索优化服务
  • 西安市做网站的网络营销策略包括哪些
  • wordpress 文章 打赏南京百度seo公司
  • 广州手机网站建设公司百度推广投诉中心
  • 英文版网站建设方案seo和网络推广有什么区别
  • 新泰房产信息与住宅网青岛seo网站推广
  • 动易网站论坛十大seo公司
  • 企业网站建设参考文献网站建设山东聚搜网络
  • org网站开发百度电脑版官网下载
  • 网站如何做地面推广网络营销怎么做
  • 武汉做网站公司hlbzx百度商城官网
  • 做网站的技术员百度指数查询官网
  • 全自动网站制作源码seo排名优化软件价格
  • 企业网站做的好百度统计网站
  • 网站外包后呗百度降权seo具体是什么
  • 南京网站建设公司临沂seo代理商
  • 分类型网站建设网址服务器查询
  • 怎么做写真网站宁波seo关键词
  • html做静态网站指数函数运算法则
  • 香河做网站百度网站排名怎么提高
  • 做装饰网站公司淘宝怎么提高关键词搜索排名
  • 微信商城入口seo关键词优化费用
  • 环境保护部网站查询建设项目互联网推广渠道
  • 怎么判断一个网站做的好爱站工具包下载
  • 外贸网站电子建设湖南搜索引擎推广平台
  • 两个域名同时指向一个网站网站友情链接交易平台
  • 企业的建站方式优化网络培训
  • 青海网站制作公司怎么在网上做广告