随笔分类 -  cocos2D制作笔记

摘要:项目中最近切换了TypeScript,运行时没有问题的,但是打包的时候会报很多的错,最后我们是在报错的文件上方加上了 '// @ts-ignore'隐藏了ts文件的报错,建议我们在使用的时候在这句代码给定相应的注释,解释一下为什么使用。 if (this.type) { // @ts-ignore: 阅读全文
posted @ 2022-09-28 16:01 jiaxin2015 阅读(1593) 评论(0) 推荐(0)
摘要://获取节点的位置this.node.getSiblingIndex() 插入节点的位置 find(ModalMgr.popUpRoot)?.insertChild(this.uiModal.node, 1); 阅读全文
posted @ 2022-09-28 15:56 jiaxin2015 阅读(33) 评论(0) 推荐(0)
摘要:let spriteFrame = new SpriteFrame(); if (!this.renderTexture) { let renderTexture = this.renderTexture = new RenderTexture(); let frameSize = view.get 阅读全文
posted @ 2022-09-28 14:56 jiaxin2015 阅读(44) 评论(0) 推荐(0)
摘要:let frameSize = view.getVisibleSize(); frameSize.width frameSize.height 阅读全文
posted @ 2022-09-28 14:48 jiaxin2015 阅读(24) 评论(0) 推荐(0)
摘要:1、通过UITransform组件来设置节点大小 let size: Size = new Size(100, 200); let uiTransform = this.blocker.node.getComponent(UITransform); uiTransform?.setContentSi 阅读全文
posted @ 2022-09-21 13:59 jiaxin2015 阅读(587) 评论(0) 推荐(0)
摘要:1、2.x的版本的层级修改 zIndex this..node.zIndex = 1; 2、3.0的时候是通过UITransform中的priority设置 2、3.1开始使用 setSiblingIndex this..node.setSiblingIndex(1); 具体的版变更,可以参考升级指 阅读全文
posted @ 2022-09-21 13:56 jiaxin2015 阅读(1351) 评论(0) 推荐(0)
摘要:1、技术概述 使用该技术的情况:在游戏开发中 怪物AI逻辑的实现 学习必要性:实现怪物AI逻辑 难点:该技术只是将状态模式运用于怪物AI的实现,没有特别的难点 2、技术案例 状态模式 在面向对象系统设计中,经常会遇到依赖于状态的对象。对象的行为会根据状态的改变而改变。 例如:一个怪物(人)对象,在饿 阅读全文
posted @ 2022-09-21 10:18 jiaxin2015 阅读(362) 评论(0) 推荐(0)
摘要:1、单次动画实现 let node = sf.meteor.node; tween(node) .to(.1, { scale: v3(.6, .6, 0) })//0.1秒,执行完大小的变化 .call(() => { console.log("上面动画执行完后回调"); }) .to(.2, { 阅读全文
posted @ 2022-09-21 10:15 jiaxin2015 阅读(764) 评论(0) 推荐(0)