中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

小清新個人網(wǎng)站今日頭條新聞發(fā)布

小清新個人網(wǎng)站,今日頭條新聞發(fā)布,網(wǎng)頁美工設計ppt,威客網(wǎng)站建設目錄 見縫插針UI腳本針腳本球腳本心得_旋轉(zhuǎn)心得_更改父節(jié)點心得_緩動動畫成品展示圖 見縫插針 本人只是看了老師的大綱,中途不明白不會的時候再去看的視頻 所以代碼可能與老師代碼有出入 SIKI_學院_點擊跳轉(zhuǎn) UI腳本 import { _decorator, Camera, color, Component, directo…

目錄

  • 見縫插針
    • UI腳本
    • 針腳本
    • 球腳本
    • 心得_旋轉(zhuǎn)
    • 心得_更改父節(jié)點
    • 心得_緩動動畫
    • 成品展示圖

見縫插針

本人只是看了老師的大綱,中途不明白不會的時候再去看的視頻
所以代碼可能與老師代碼有出入
SIKI_學院_點擊跳轉(zhuǎn)

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(){  //  結(jié)束緩動動畫函數(shù)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等待發(fā)射 0發(fā)射 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)       //  更新父節(jié)點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)}      //  發(fā)射速度}
}

move 函數(shù)處于性能考慮
應該在條件判斷成立時 返回的,不應該多個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}}
}

心得_旋轉(zhuǎn)

在這里插入圖片描述
項目設置 > 功能裁剪 > 2D物理系統(tǒng) > 內(nèi)置2D物理系統(tǒng)
在不改內(nèi)置的情況下

this.node.angle += 2    //  旋轉(zhuǎn)角度速度

球旋轉(zhuǎn)會卡住不動,取消剛體組件也可以使其正常旋轉(zhuǎn),但碰撞就會有點麻煩

心得_更改父節(jié)點

在變更父節(jié)點的時候,子節(jié)點的位置和角度會被重置
不想重置,就需要記錄之前的位置和角度,更換后再設置回來

        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)       //  更新父節(jié)點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緩動執(zhí)行時間 2組件需要緩動變更的屬性
start 開始

    on_anim(){  //  結(jié)束緩動動畫函數(shù)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://m.risenshineclean.com/news/62765.html

相關(guān)文章:

  • 企業(yè)家居網(wǎng)站建設東莞seo建站
  • 網(wǎng)站flash引導頁下載廣州最新疫情最新消息
  • 做投資的網(wǎng)站好百度搜索官網(wǎng)
  • b2b電子商務的模式有哪些seo是指什么崗位
  • 嘉興快速建站合作阿里云域名注冊官網(wǎng)網(wǎng)址
  • 做的網(wǎng)站百度沒收錄關(guān)鍵詞舉例
  • 怎么看網(wǎng)站是用什么程序做的百度網(wǎng)頁電腦版入口
  • 簡單網(wǎng)頁html模板西安的網(wǎng)絡優(yōu)化公司
  • 網(wǎng)站建設 網(wǎng)址導航網(wǎng)站seo啥意思
  • 常州免費網(wǎng)站制作百度推廣登錄后臺登錄入口
  • 做外包胡it網(wǎng)站有哪些網(wǎng)頁設計公司
  • 建個可以注冊會員網(wǎng)站多少錢陽泉seo
  • 做網(wǎng)站運維應該看的書朋友圈產(chǎn)品推廣文案
  • 玉林市城鄉(xiāng)建設委員會網(wǎng)站什么軟件可以免費引流
  • 百度站長工具鏈接提交長沙優(yōu)化網(wǎng)站
  • 網(wǎng)站建設銷售好做合肥seo網(wǎng)站排名
  • 網(wǎng)站運營團隊成人大專
  • 重慶政府是指什么廣州網(wǎng)站運營專業(yè)樂云seo
  • 大連模版網(wǎng)站seo服務優(yōu)化
  • wordpress插件小蜜蜂seo的形式有哪些
  • 給網(wǎng)站做排名優(yōu)化學什么好處百度數(shù)據(jù)查詢
  • 免費建網(wǎng)站域名新聞頭條新聞
  • wordpress 后臺列表惠東seo公司
  • 有哪些網(wǎng)站結(jié)構(gòu)是不合理的企業(yè)網(wǎng)站注冊
  • 寧波網(wǎng)站建設使用技巧分享陜西seo優(yōu)化
  • 做分析圖用的地圖網(wǎng)站免費創(chuàng)建網(wǎng)站的平臺
  • 網(wǎng)站開發(fā)公司加盟seo資料網(wǎng)
  • 大淘客網(wǎng)站如何做制作常用的網(wǎng)絡推廣手段有哪些
  • 博星卓越電子商務網(wǎng)站建設實訓平臺服裝品牌策劃及營銷推廣方案
  • 專業(yè)做二手房的網(wǎng)站有哪些安徽網(wǎng)站seo