123456789101112131415161718192021222324252627282930313233343536373839 |
- import { _decorator, Component, Node, sp } from 'cc';
- import { constant } from '../framework/constant';
- const { ccclass, property } = _decorator;
- const OUTOFBOUNCE = 50
- @ccclass('enemyPlane')
- export class enemyPlane extends Component {
- // @property
- // public enemySpeed = 0;
- private _enemySpeed = 0;
- public enemyType = constant.EnemyPlaneType.TYPE1
- start() {
- }
- update(deltaTime: number) {
- const pos = this.node.position;
- const movePos = pos.x - this._enemySpeed;
- this.node.setPosition(movePos, pos.y, pos.z)
- if(movePos > OUTOFBOUNCE){
- this.node.destroy()
- }
-
-
- }
- show(speed:number){
- this._enemySpeed = speed
- }
- }
|