CocosCreator-3.0-动态生成3种敌人
-
- import { _decorator, Component, Node, Label, Sprite, Vec3, Prefab, instantiate, director, resources, SpriteFrame, Layers, UITransform, Canvas, view, View } from 'cc';
- const { ccclass, property } = _decorator;
-
- // 全局变量
- var nodeFatherX: Node;
- var frame: number = 0; //总共绘制的帧数
- var arrayPlane = [];
- var arrayPlaneNunber: number = -2; //累计生成敌人数
- var gameWidthX: number = 0; //游戏宽度
- var gameHeightX: number = 0; //游戏高度
-
- @ccclass('Fish')
- export class Fish extends Component {
- // [1]
- // dummy = '';
-
- // [2]
- // @property
- // serializableDummy = 0;
-
- @property({ type: SpriteFrame })
- public spriteFrameEnemyBig: SpriteFrame | null = null; // 精灵框架敌人大号
- @property({ type: SpriteFrame })
- public spriteFrameEnemyMid: SpriteFrame | null = null; // 精灵框架敌人中号
- @property({ type: SpriteFrame })
- public spriteFrameEnemySmall: SpriteFrame | null = n