国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁(yè) > news >正文

襄陽(yáng)做網(wǎng)站 優(yōu)幫云seo軟件優(yōu)化工具軟件

襄陽(yáng)做網(wǎng)站 優(yōu)幫云,seo軟件優(yōu)化工具軟件,公司推廣網(wǎng)站建設(shè)話(huà)術(shù),領(lǐng)動(dòng)營(yíng)銷(xiāo)網(wǎng)站建設(shè)目錄 見(jiàn)縫插針UI腳本針腳本球腳本心得_旋轉(zhuǎn)心得_更改父節(jié)點(diǎn)心得_緩動(dòng)動(dòng)畫(huà)成品展示圖 見(jiàn)縫插針 本人只是看了老師的大綱,中途不明白不會(huì)的時(shí)候再去看的視頻 所以代碼可能與老師代碼有出入 SIKI_學(xué)院_點(diǎn)擊跳轉(zhuǎn) UI腳本 import { _decorator, Camera, color, Component, directo…

目錄

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

見(jiàn)縫插針

本人只是看了老師的大綱,中途不明白不會(huì)的時(shí)候再去看的視頻
所以代碼可能與老師代碼有出入
SIKI_學(xué)院_點(diǎn)擊跳轉(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é)束緩動(dòng)動(dòng)畫(huà)函數(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剛生成時(shí) -1等待發(fā)射 0發(fā)射 1完成碰撞start() {const col = this.getComponent(Collider2D)if (col){col.on(Contact2DType.BEGIN_CONTACT,this.on_bc,this)}   //  開(kāi)啟碰撞else {console.log(`針頭 開(kāi)啟碰撞異常`)}input.on(Input.EventType.TOUCH_END , this.on_te , this)     //  開(kāi)啟觸摸}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é)點(diǎn)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ù)處于性能考慮
應(yīng)該在條件判斷成立時(shí) 返回的,不應(yīng)該多個(gè)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(`球 開(kāi)啟碰撞異常`)}}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)

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

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

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

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

在變更父節(jié)點(diǎn)的時(shí)候,子節(jié)點(diǎn)的位置和角度會(huì)被重置
不想重置,就需要記錄之前的位置和角度,更換后再設(shè)置回來(lái)

        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é)點(diǎn)this.node.setWorldPosition(pw)this.node.setWorldRotation(rw)this.move_sp = 1const ui = ts_ui.getinthis()ui.pin_num = 0ui.on_fen(1)}

心得_緩動(dòng)動(dòng)畫(huà)

還沒(méi)有仔細(xì)研究,看了老師的視頻,依葫蘆畫(huà)瓢
但看使用情況來(lái)看,以下是個(gè)人理解
tween 傳入緩動(dòng)組件
to 傳入 1緩動(dòng)執(zhí)行時(shí)間 2組件需要緩動(dòng)變更的屬性
start 開(kāi)始

    on_anim(){  //  結(jié)束緩動(dòng)動(dòng)畫(huà)函數(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://aloenet.com.cn/news/47265.html

相關(guān)文章:

  • dz網(wǎng)站建設(shè)數(shù)據(jù)分析平臺(tái)
  • 做股東變更要上哪個(gè)網(wǎng)站獲客渠道有哪些
  • 信息產(chǎn)業(yè)部網(wǎng)站備案查詢(xún)新聞?lì)^條最新消息摘抄
  • 廣州嘉怡服飾有限公司網(wǎng)站建設(shè)請(qǐng)你設(shè)計(jì)一個(gè)網(wǎng)絡(luò)營(yíng)銷(xiāo)方案
  • 那些網(wǎng)站建設(shè)的好登錄百度app
  • wordpress網(wǎng)站主題插件網(wǎng)站推廣方式
  • 怎樣免費(fèi)做網(wǎng)站搜索引擎排名影響因素有哪些
  • 網(wǎng)站建設(shè)方案報(bào)價(jià)百度seo公司報(bào)價(jià)
  • flash做網(wǎng)站網(wǎng)站查詢(xún)?nèi)肟?/a>
  • 北海市做網(wǎng)站的公司網(wǎng)絡(luò)推廣公司網(wǎng)站
  • 怎么做離線網(wǎng)站網(wǎng)站注冊(cè)要多少錢(qián)
  • 泉州專(zhuān)門(mén)做網(wǎng)站品牌策劃書(shū)
  • 東莞h5網(wǎng)站建設(shè)宣傳推廣策略
  • 泉州企業(yè)免費(fèi)建站雞西seo
  • 手機(jī)怎么做網(wǎng)站賣(mài)東西營(yíng)銷(xiāo)技巧美劇
  • 濟(jì)南免費(fèi)網(wǎng)站建設(shè)優(yōu)化網(wǎng)站管理
  • 響應(yīng)式網(wǎng)站是什么軟件做的app注冊(cè)拉新平臺(tái)
  • 企業(yè)網(wǎng)站建設(shè)哪家便宜游戲推廣渠道
  • 學(xué)院網(wǎng)站建設(shè)服務(wù)宗旨電商平臺(tái)排名
  • 南寧網(wǎng)絡(luò)推廣工作網(wǎng)絡(luò)優(yōu)化seo薪酬
  • 景安網(wǎng)站備案的服務(wù)碼韓國(guó)熱搜榜
  • 聽(tīng)書(shū)網(wǎng)頁(yè)設(shè)計(jì)教程成都seo
  • 動(dòng)態(tài)網(wǎng)站開(kāi)發(fā)技術(shù)哪幾種seo搜索引擎優(yōu)化入門(mén)
  • html網(wǎng)站開(kāi)發(fā)心得體會(huì)查淘寶關(guān)鍵詞排名軟件
  • seo網(wǎng)站制作產(chǎn)品seo標(biāo)題是什么
  • 怎樣做微信小程序seo項(xiàng)目培訓(xùn)
  • 網(wǎng)站建設(shè)價(jià)格明細(xì)表和網(wǎng)站預(yù)算網(wǎng)站推廣常用方法
  • 網(wǎng)站代碼設(shè)計(jì)外貿(mào)網(wǎng)站如何推廣優(yōu)化
  • 網(wǎng)上服務(wù)平臺(tái)社保南昌seo報(bào)價(jià)
  • 提供網(wǎng)站建設(shè)公司哪家好ps培訓(xùn)