Commit 9b065afa authored by wildfirecode's avatar wildfirecode

1

parent 0dca725c
{
"name": "RedFire",
"root": {
"uuid": "20190301114308",
"components": [
{
"script": "components/base/Transform"
},
{
"script": "components/other/CameraController"
}
],
"children": [
{
"uuid": "20190301114245",
"name": "RedFire",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "./scripts/scenes/RedFireItem",
"properties": {}
}
],
"children": [
{
"name": "Image",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextureRenderer",
"properties": {
"texture": "res|1dd2cb82-b58a-49d5-9e87-a585b1d44d2d"
}
}
],
"uuid": "35827ccd-03af-42fd-868b-5ba42f8ee992"
}
]
}
]
},
"entity-cache": []
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"83d50df9-266c-478f-bf01-21d478abe049","subMetas":{},"type":"prefab"}
...@@ -64,7 +64,8 @@ ...@@ -64,7 +64,8 @@
"properties": { "properties": {
"bulletNumTxt": "entity|f02aa1f7-3255-405e-a537-7ba4ef503aa7", "bulletNumTxt": "entity|f02aa1f7-3255-405e-a537-7ba4ef503aa7",
"strengthNumTxt": "entity|70838016-4fab-4a0f-90aa-61c4303a4ecc", "strengthNumTxt": "entity|70838016-4fab-4a0f-90aa-61c4303a4ecc",
"BallItemPrefab": "res|8ebdfe78-ea44-445d-8bbe-02a22874e896" "BallItemPrefab": "res|8ebdfe78-ea44-445d-8bbe-02a22874e896",
"RedFirePrefab": "res|83d50df9-266c-478f-bf01-21d478abe049"
} }
} }
], ],
...@@ -703,6 +704,10 @@ ...@@ -703,6 +704,10 @@
"uuid": "8ebdfe78-ea44-445d-8bbe-02a22874e896", "uuid": "8ebdfe78-ea44-445d-8bbe-02a22874e896",
"url": "prefabs/BallItem.pfb" "url": "prefabs/BallItem.pfb"
}, },
{
"uuid": "83d50df9-266c-478f-bf01-21d478abe049",
"url": "prefabs/RedFire.pfb"
},
{ {
"uuid": "e00fab97-a62c-459b-a61b-a9d7a1e10a21", "uuid": "e00fab97-a62c-459b-a61b-a9d7a1e10a21",
"url": "sheets/play.sht-disperse", "url": "sheets/play.sht-disperse",
...@@ -755,6 +760,14 @@ ...@@ -755,6 +760,14 @@
{ {
"name": "黄-1.png", "name": "黄-1.png",
"uuid": "4db8fa73-7721-42e3-bf6c-d4665dbbfe32" "uuid": "4db8fa73-7721-42e3-bf6c-d4665dbbfe32"
},
{
"name": "淡蓝火箭-1.png",
"uuid": "aa4bc010-fa6b-4194-8795-8321390f0ff4"
},
{
"name": "red20.png",
"uuid": "1dd2cb82-b58a-49d5-9e87-a585b1d44d2d"
} }
] ]
} }
......
import ScillaComponent from 'components/base/ScillaComponent'; import Body from './Body';
import { Transform } from 'scilla-components/src';
import { gravityY } from './gameconst';
export default class BallItem extends ScillaComponent { export default class BallItem extends Body {
private _bounceY = 0;
private _velocityY = 0;
onUpdate() {
const { entity } = this;
this._velocityY += gravityY;
entity.getComponent(Transform).position.y += this._velocityY;
}
revertY() {
this._velocityY *= -1 * this._bounceY;
console.log(this._velocityY)
}
set bounceY(val: number) {
this._bounceY = val;
}
get bounceY() {
return this._bounceY;
}
} }
\ No newline at end of file
import ScillaComponent from 'components/base/ScillaComponent';
import { Transform } from 'scilla-components/src';
import { gravityY } from './gameconst';
export default class Body extends ScillaComponent {
bounceY = 0;
private _velocityY = 0;
onUpdate() {
const { entity } = this;
this._velocityY += gravityY;
entity.getComponent(Transform).position.y += this._velocityY;
}
revertY() {
this._velocityY *= -1 * this.bounceY;
console.log(this._velocityY)
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"164cf9b9-aaf6-4628-ad67-9f6fb146e7e9","subMetas":{},"type":"script"}
import Body from './Body';
import ScillaComponent from 'scilla-components/src/base/ScillaComponent';
export default class RedFireItem extends ScillaComponent {
constructor() {
super();
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"f380be1a-f683-4034-88b3-95f43e606364","subMetas":{},"type":"script"}
/** /**
* Created by rockyl on 2019-04-09. * Created by rockyl on 2019-04-09.
*/ */
import { Component, Entity, resource, instantiate } from "scilla"; import { Component, Entity, resource, instantiate } from "scilla";
import { alien } from "../navigator/StackNavigator"; import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator"; import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform } from 'scilla-components/src'; import { Transform } from 'scilla-components/src';
import ScillaComponent from 'scilla-components/src/base/ScillaComponent';
import BallItem from './BallItem'; import BallItem from './BallItem';
import RedFireItem from './RedFireItem';
import ScillaComponent from 'scilla-components/src/base/ScillaComponent';
const GROUND_Y = 250; //碰到地板时,球的中心点的y const GROUND_Y = 250; //碰到地板时,球的中心点的y
export default class ScenePlay extends ScillaComponent implements INavigatorViewBase { export default class ScenePlay extends ScillaComponent implements INavigatorViewBase {
BallItemPrefab: resource; BallItemPrefab: resource;
testPrefab: resource; RedFirePrefab: resource;
bulletNumTxt: Entity; bulletNumTxt: Entity;
strengthNumTxt: Entity; strengthNumTxt: Entity;
ballList: Entity[]; ballList: Entity[];
redFireList: Entity[];
getRedFireItem() {
const redFire = instantiate(this.RedFirePrefab);
this.entity.addChild(redFire);
this.redFireList.push(redFire);
// (redFire.getComponent(RedFireItem) as RedFireItem).bounceY = 0.9;
}
getBallItem() { getBallItem() {
const ball = instantiate(this.BallItemPrefab); const ball = instantiate(this.BallItemPrefab);
this.entity.addChild(ball); this.entity.addChild(ball);
this.ballList.push(ball); this.ballList.push(ball);
console.log(ball.getComponent(Transform).position.y); console.log(ball.getComponent(Transform).position.y);
(ball.getComponent(BallItem) as BallItem).bounceY = 0.99; (ball.getComponent(BallItem) as BallItem).bounceY = 1;
} }
onAwake() { onAwake() {
...@@ -43,7 +51,8 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView ...@@ -43,7 +51,8 @@ export default class ScenePlay extends ScillaComponent implements INavigatorView
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void { onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
(this.entity.getComponent(Transform) as Transform).alpha = 1; (this.entity.getComponent(Transform) as Transform).alpha = 1;
this.getBallItem(); // this.getBallItem();
this.getRedFireItem();
} }
onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void { onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
......
{"ver":"1.0.1","uuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","subMetas":{"火-1.png":{"ver":"1.0.1","uuid":"94680781-2b1b-432e-9858-4ff21dd04d0c","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"火箭-1.png":{"ver":"1.0.1","uuid":"2f8360c7-b059-4f1e-b651-37a32eb4a247","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"发弹雾气-1.png":{"ver":"1.0.1","uuid":"f67e2e09-e0f4-4aea-8243-8d86a4ded38a","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"1-1-1.png":{"ver":"1.0.1","uuid":"cb4651fa-3d76-43c6-89a9-d06ddda3c110","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"大炮板子-1.png":{"ver":"1.0.1","uuid":"abdded14-a2d2-4000-b264-9ff47c843149","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"大炮的头-1.png":{"ver":"1.0.1","uuid":"ade44f23-754d-4923-a713-76f4207c3bde","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"淡蓝-1.png":{"ver":"1.0.1","uuid":"2952264c-5a8b-4eda-9a15-812e4e7738ae","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"紫-1.png":{"ver":"1.0.1","uuid":"60460a1c-e1b6-45c6-a905-f1233ffd0853","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"红-1.png":{"ver":"1.0.1","uuid":"98d8e939-fbfb-46fa-9622-60164aa8aa4b","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"绿-1.png":{"ver":"1.0.1","uuid":"8babbf6b-a2a2-4fc0-a634-4268607cbf9c","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"蓝-1.png":{"ver":"1.0.1","uuid":"b664db72-fb4f-45fb-8f50-908f3d133bdc","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"黄-1.png":{"ver":"1.0.1","uuid":"4db8fa73-7721-42e3-bf6c-d4665dbbfe32","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"}},"type":"sheet"} {"ver":"1.0.1","uuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","subMetas":{"火-1.png":{"ver":"1.0.1","uuid":"94680781-2b1b-432e-9858-4ff21dd04d0c","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"火箭-1.png":{"ver":"1.0.1","uuid":"2f8360c7-b059-4f1e-b651-37a32eb4a247","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"发弹雾气-1.png":{"ver":"1.0.1","uuid":"f67e2e09-e0f4-4aea-8243-8d86a4ded38a","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"1-1-1.png":{"ver":"1.0.1","uuid":"cb4651fa-3d76-43c6-89a9-d06ddda3c110","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"大炮板子-1.png":{"ver":"1.0.1","uuid":"abdded14-a2d2-4000-b264-9ff47c843149","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"大炮的头-1.png":{"ver":"1.0.1","uuid":"ade44f23-754d-4923-a713-76f4207c3bde","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"淡蓝-1.png":{"ver":"1.0.1","uuid":"2952264c-5a8b-4eda-9a15-812e4e7738ae","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"紫-1.png":{"ver":"1.0.1","uuid":"60460a1c-e1b6-45c6-a905-f1233ffd0853","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"红-1.png":{"ver":"1.0.1","uuid":"98d8e939-fbfb-46fa-9622-60164aa8aa4b","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"绿-1.png":{"ver":"1.0.1","uuid":"8babbf6b-a2a2-4fc0-a634-4268607cbf9c","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"蓝-1.png":{"ver":"1.0.1","uuid":"b664db72-fb4f-45fb-8f50-908f3d133bdc","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"黄-1.png":{"ver":"1.0.1","uuid":"4db8fa73-7721-42e3-bf6c-d4665dbbfe32","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"淡蓝火箭-1.png":{"ver":"1.0.1","uuid":"aa4bc010-fa6b-4194-8795-8321390f0ff4","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"},"red20.png":{"ver":"1.0.1","uuid":"1dd2cb82-b58a-49d5-9e87-a585b1d44d2d","rawTextureUuid":"e00fab97-a62c-459b-a61b-a9d7a1e10a21","type":"texture"}},"type":"sheet"}
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
import {registerDef} from 'scilla' import {registerDef} from 'scilla'
import component0 from 'components/renderer/TextRenderer'; import component0 from 'components/animation/TouchZoom';
registerDef('components/renderer/TextRenderer', component0); registerDef('components/animation/TouchZoom', component0);
import component1 from 'components/base/Transform'; import component1 from 'components/base/Transform';
registerDef('components/base/Transform', component1); registerDef('components/base/Transform', component1);
...@@ -26,14 +26,14 @@ registerDef('components/renderer/TextureRenderer', component5); ...@@ -26,14 +26,14 @@ registerDef('components/renderer/TextureRenderer', component5);
import component6 from 'components/other/RelativeLayout'; import component6 from 'components/other/RelativeLayout';
registerDef('components/other/RelativeLayout', component6); registerDef('components/other/RelativeLayout', component6);
import component7 from 'components/other/CameraController'; import component7 from 'components/renderer/TextRenderer';
registerDef('components/other/CameraController', component7); registerDef('components/renderer/TextRenderer', component7);
import component8 from 'components/ui/Button'; import component8 from 'components/ui/Button';
registerDef('components/ui/Button', component8); registerDef('components/ui/Button', component8);
import component9 from 'components/animation/TouchZoom'; import component9 from 'components/other/CameraController';
registerDef('components/animation/TouchZoom', component9); registerDef('components/other/CameraController', component9);
import component10 from '../../assets/scripts/scenes/SceneStart'; import component10 from '../../assets/scripts/scenes/SceneStart';
registerDef('./scripts/scenes/SceneStart', component10); registerDef('./scripts/scenes/SceneStart', component10);
...@@ -52,3 +52,9 @@ registerDef('./scripts/dialogs/RulePanel', component14); ...@@ -52,3 +52,9 @@ registerDef('./scripts/dialogs/RulePanel', component14);
import component15 from '../../assets/scripts/scenes/BallItem'; import component15 from '../../assets/scripts/scenes/BallItem';
registerDef('./scripts/scenes/BallItem', component15); registerDef('./scripts/scenes/BallItem', component15);
import component16 from '../../assets/scripts/scenes/testC';
registerDef('./scripts/scenes/testC', component16);
import component17 from '../../assets/scripts/scenes/RedFireItem';
registerDef('./scripts/scenes/RedFireItem', component17);
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