Commit c5423766 authored by wildfirecode's avatar wildfirecode

1

parent 32f4104c
......@@ -21,7 +21,8 @@
},
{
"script": "./scripts/scenes/BulletItem",
"properties": {}
"properties": {},
"disabled": false
}
],
"children": [
......
......@@ -585,6 +585,12 @@
"height": 110
},
"disabled": false
},
{
"script": "./scripts/scenes/scenePlay/CarBulletAni",
"properties": {
"BulletItemPrefab": "res|df59e078-e7b7-4fbb-a1aa-8b291284c39f"
}
}
],
"uuid": "ebfde024-e9b9-40cb-a866-c0b194446b35",
......@@ -601,6 +607,14 @@
"_type_": "scilla/support/Vector2D"
}
}
},
{
"script": "./scripts/scenes/scenePlay/CarShootAni",
"properties": {
"body": "entity|5e34a5e7-e298-4fda-a244-737cb992bc81",
"smoke": "entity|7779fb7e-1935-4600-beb2-bd86ed7cbf44"
},
"disabled": false
}
],
"uuid": "a5b807ba-098f-4b6e-b0da-e42b6324f62a",
......@@ -624,7 +638,8 @@
}
}
],
"uuid": "396837ee-1f43-496e-aa64-d2a3bd65b53d"
"uuid": "396837ee-1f43-496e-aa64-d2a3bd65b53d",
"disabled": false
},
{
"name": "Image",
......@@ -645,7 +660,8 @@
}
}
],
"uuid": "5e34a5e7-e298-4fda-a244-737cb992bc81"
"uuid": "5e34a5e7-e298-4fda-a244-737cb992bc81",
"disabled": false
},
{
"name": "Image",
......@@ -710,7 +726,8 @@
}
}
],
"uuid": "7779fb7e-1935-4600-beb2-bd86ed7cbf44"
"uuid": "7779fb7e-1935-4600-beb2-bd86ed7cbf44",
"disabled": false
}
]
}
......@@ -1282,7 +1299,8 @@
],
"disabled": true
}
]
],
"disabled": false
}
]
},
......
......@@ -10,10 +10,12 @@ import BallItem from "./BallItem";
import Body from "./Body";
import { removeFromList } from "./_";
import InteractComponent from "scilla-components/src/base/InteractComponent";
import CarShootAni from "./scenePlay/CarShootAni";
import CarBulletAni from "./scenePlay/CarBulletAni";
export default class ScenePlay extends InteractComponent implements INavigatorViewBase {
BallItemPrefab: resource;
BulletItemPrefab: resource;
// BulletItemPrefab: resource;
RedFirePrefab: resource;
BlueRocketPrefab: resource;
YellowRocketPrefab: resource;
......@@ -30,15 +32,28 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
ballList: Body[];
drops: Body[];
bullets: Body[];
freeBullets: Body[];
// freeBullets: Body[];
_carShootAni: CarShootAni;
_carBulletAni: CarBulletAni;
// onGlobalTouchBegin(e): any {
// setX(this.car, e.x - 375);
// return super.onGlobalTouchBegin(e);
// }
_lastTouchMoveX = -1;
onGlobalTouchMove(e: { x, y }) {
setX(this.car, e.x - 375);
if (this._lastTouchMoveX == -1) {
this._lastTouchMoveX = e.x;
}
let targetX = getX(this.car) + e.x - this._lastTouchMoveX;
if (targetX < -375)
targetX = -375;
if (targetX > 375)
targetX = 375;
setX(this.car, targetX);
this._lastTouchMoveX = e.x;
// console.log(targetX)
return super.onGlobalTouchMove(e);
}
......@@ -46,24 +61,24 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
this.checkRemoveBullets();
}
removeBullet(body: Body) {
body.entity.enabled = false;
this.entity.removeChild(body.entity);
removeFromList(body, this.bodys);
removeFromList(body, this.bullets);
this.freeBullets.push(body);
console.log(this.bullets.length, this.freeBullets.length)
}
// removeBullet(body: Body) {
// body.entity.enabled = false;
// this.entity.removeChild(body.entity);
// removeFromList(body, this.bodys);
// removeFromList(body, this.bullets);
// this.freeBullets.push(body);
// // console.log(this.bullets.length, this.freeBullets.length)
// }
checkRemoveBullets() {
for (let i = 0; i < this.bullets.length; i++) {
const bullet = this.bullets[i];
const y = getY(bullet.entity)
if (y < -1624 / 2) { //子弹失效
this.removeBullet(bullet);
i--;
}
}
// for (let i = 0; i < this.bullets.length; i++) {
// const bullet = this.bullets[i];
// const y = getY(bullet.entity)
// if (y < -1624 / 2) { //子弹失效
// this.removeBullet(bullet);
// i--;
// }
// }
}
onDrops(ball: Body) {
......@@ -78,21 +93,10 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
return item;
}
createBullet() {
let bullet: Body;
let item: Entity;
if (this.freeBullets.length > 0) {
bullet = this.freeBullets.pop();
item = bullet.entity;
item.enabled = true;
} else {
item = instantiate(this.BulletItemPrefab);
bullet = item.getComponent(Body);
}
this.entity.addChild(item);
bulletCreated(bullet: Body) {
this.entity.addChild(bullet.entity);
this.bodys.push(bullet);
this.bullets.push(bullet);
setXY(item, getX(this.car), getY(this.car) - 100);
}
getFireItem(res: resource) {
......@@ -130,7 +134,9 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
this.ballList = [];
this.drops = [];
this.bullets = [];
this.freeBullets = [];
// this.freeBullets = [];
this._carShootAni = this.car.getComponent(CarShootAni);
this._carBulletAni = this.car.getComponent(CarBulletAni);
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
......@@ -140,7 +146,7 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
// this.onGameOver();
// }, 3000);
setInterval(() => { this.createBullet() }, 1000 / 15);
// setInterval(() => { this.createBullet() }, 1000 / 10);
// setInterval(() => {
// this.createBigBall();
......
{"ver":"1.0.1","uuid":"78241f13-a5ce-4eb9-8455-97ff2004f0e2","subMetas":{},"isGroup":true}
import ScillaComponent from 'components/base/ScillaComponent';
import { Entity, instantiate, resource } from 'scilla/src';
import Body from '../Body';
import { setXY, getX, getY } from 'assets/scripts/transformUtils';
export default class CarBulletAni extends ScillaComponent {
BulletItemPrefab: resource;
private _interval = 10;
//等级1 2 3 4
private _level: number;
freeBullets: Body[];
onAwake() {
super.onAwake();
this.freeBullets = [];
}
_counter = 0;
onUpdate(t) {
super.onUpdate(t);
this._counter++;
if (this._counter > this._interval) {
this._counter = 0;
this.createBullet();
}
}
removeBullet(body: Body) {
// body.entity.enabled = false;
// this.entity.removeChild(body.entity);
// removeFromList(body, this.bodys);
// removeFromList(body, this.bullets);
// this.freeBullets.push(body);
}
createBullet() {
let bullet: Body;
let item: Entity;
if (this.freeBullets.length > 0) {
bullet = this.freeBullets.pop();
item = bullet.entity;
item.enabled = true;
} else {
item = instantiate(this.BulletItemPrefab);
bullet = item.getComponent(Body);
}
// this.entity.addChild(item);
// this.bodys.push(bullet);
// this.bullets.push(bullet);
console.log(getX(this.entity), getY(this.entity) - 100);
setXY(item, getX(this.entity), getY(this.entity) - 100);
this.bubbling('bulletCreated', bullet);
}
}
{"ver":"1.0.1","uuid":"8525cc2b-6dbc-4f0e-9fe1-256a2811c705","subMetas":{},"type":"script"}
import ScillaComponent from 'components/base/ScillaComponent';
import { Entity } from 'scilla/src';
import { getY, setY } from 'assets/scripts/transformUtils';
export default class CarShootAni extends ScillaComponent {
body: Entity;
smoke: Entity;
_bodyY: number;
onAwake() {
super.onAwake();
this._bodyY = getY(this.body);
}
_counter = 0;
onUpdate(t) {
super.onUpdate(t);
this._counter++;
if (this._counter > 1) {
this._counter = 0;
const bodyY = getY(this.body);
const targetY = bodyY == this._bodyY ? this._bodyY + 3 : this._bodyY;
setY(this.body, targetY);
this.smoke.enabled = !this.smoke.enabled;
}
}
}
{"ver":"1.0.1","uuid":"e78ad988-e1f0-4505-a1c7-8d40b26790c2","subMetas":{},"type":"script"}
No preview for this file type
assets/sheets/play.sht/子弹-1.png

1.36 KB | W: | H:

assets/sheets/play.sht/子弹-1.png

3.52 KB | W: | H:

assets/sheets/play.sht/子弹-1.png
assets/sheets/play.sht/子弹-1.png
assets/sheets/play.sht/子弹-1.png
assets/sheets/play.sht/子弹-1.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -5,8 +5,8 @@
import {registerDef} from 'scilla'
import component0 from 'components/other/RelativeLayout';
registerDef('components/other/RelativeLayout', component0);
import component0 from 'components/renderer/RectRenderer';
registerDef('components/renderer/RectRenderer', component0);
import component1 from 'components/base/Transform';
registerDef('components/base/Transform', component1);
......@@ -23,11 +23,11 @@ registerDef('components/other/FullStageSize', component4);
import component5 from 'components/base/TouchInterrupt';
registerDef('components/base/TouchInterrupt', component5);
import component6 from 'components/renderer/RectRenderer';
registerDef('components/renderer/RectRenderer', component6);
import component6 from 'components/other/CameraController';
registerDef('components/other/CameraController', component6);
import component7 from 'components/other/CameraController';
registerDef('components/other/CameraController', component7);
import component7 from 'components/other/RelativeLayout';
registerDef('components/other/RelativeLayout', component7);
import component8 from 'components/renderer/TextureRenderer';
registerDef('components/renderer/TextureRenderer', component8);
......@@ -41,8 +41,8 @@ registerDef('components/animation/TouchZoom', component10);
import component11 from 'components/ui/Button';
registerDef('components/ui/Button', component11);
import component12 from '../../assets/scripts/api/SampleApi';
registerDef('./scripts/api/SampleApi', component12);
import component12 from '../../assets/scripts/dialogs/RuleDialogContent';
registerDef('./scripts/dialogs/RuleDialogContent', component12);
import component13 from '../../assets/scripts/api/SamplePollingApi';
registerDef('./scripts/api/SamplePollingApi', component13);
......@@ -53,38 +53,44 @@ registerDef('./scripts/scenes/SceneStart', component14);
import component15 from '../../assets/scripts/scenes/SceneController';
registerDef('./scripts/scenes/SceneController', component15);
import component16 from '../../assets/scripts/popup/Popup';
registerDef('./scripts/popup/Popup', component16);
import component16 from '../../assets/scripts/scenes/scenePlay/CarBulletAni';
registerDef('./scripts/scenes/scenePlay/CarBulletAni', component16);
import component17 from '../../assets/scripts/navigator/SingleSceneNavigator';
registerDef('./scripts/navigator/SingleSceneNavigator', component17);
import component17 from '../../assets/scripts/scenes/scenePlay/CarShootAni';
registerDef('./scripts/scenes/scenePlay/CarShootAni', component17);
import component18 from '../../assets/scripts/dialogs/AlertDialogContent';
registerDef('./scripts/dialogs/AlertDialogContent', component18);
import component18 from '../../assets/scripts/popup/Popup';
registerDef('./scripts/popup/Popup', component18);
import component19 from '../../assets/scripts/dialogs/RuleDialogContent';
registerDef('./scripts/dialogs/RuleDialogContent', component19);
import component19 from '../../assets/scripts/navigator/SingleSceneNavigator';
registerDef('./scripts/navigator/SingleSceneNavigator', component19);
import component20 from '../../assets/scripts/scenes/ScenePlay';
registerDef('./scripts/scenes/ScenePlay', component20);
import component20 from '../../assets/scripts/dialogs/AlertDialogContent';
registerDef('./scripts/dialogs/AlertDialogContent', component20);
import component21 from '../../assets/scripts/game/CustomTextRenderer';
registerDef('./scripts/game/CustomTextRenderer', component21);
import component21 from '../../assets/scripts/scenes/ScenePlay';
registerDef('./scripts/scenes/ScenePlay', component21);
import component22 from '../../assets/scripts/MainController';
registerDef('./scripts/MainController', component22);
import component22 from '../../assets/scripts/api/SampleApi';
registerDef('./scripts/api/SampleApi', component22);
import component23 from '../../assets/scripts/dialogs/GameOverPanel';
registerDef('./scripts/dialogs/GameOverPanel', component23);
import component23 from '../../assets/scripts/game/CustomTextRenderer';
registerDef('./scripts/game/CustomTextRenderer', component23);
import component24 from '../../assets/scripts/common/Toast';
registerDef('./scripts/common/Toast', component24);
import component24 from '../../assets/scripts/MainController';
registerDef('./scripts/MainController', component24);
import component25 from '../../assets/scripts/scenes/BallItem';
registerDef('./scripts/scenes/BallItem', component25);
import component25 from '../../assets/scripts/dialogs/GameOverPanel';
registerDef('./scripts/dialogs/GameOverPanel', component25);
import component26 from '../../assets/scripts/scenes/RocketItem';
registerDef('./scripts/scenes/RocketItem', component26);
import component26 from '../../assets/scripts/common/Toast';
registerDef('./scripts/common/Toast', component26);
import component27 from '../../assets/scripts/scenes/BulletItem';
registerDef('./scripts/scenes/BulletItem', component27);
import component27 from '../../assets/scripts/scenes/BallItem';
registerDef('./scripts/scenes/BallItem', component27);
import component28 from '../../assets/scripts/scenes/RocketItem';
registerDef('./scripts/scenes/RocketItem', component28);
import component29 from '../../assets/scripts/scenes/BulletItem';
registerDef('./scripts/scenes/BulletItem', component29);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment