Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new-kickball
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
new-kickball
Commits
c5423766
Commit
c5423766
authored
Jun 03, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
32f4104c
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
187 additions
and
71 deletions
+187
-71
bullet.pfb
assets/prefabs/bullet.pfb
+2
-1
main.scene
assets/scenes/main.scene
+22
-4
ScenePlay.ts
assets/scripts/scenes/ScenePlay.ts
+40
-34
scenePlay.meta
assets/scripts/scenes/scenePlay.meta
+1
-0
CarBulletAni.ts
assets/scripts/scenes/scenePlay/CarBulletAni.ts
+56
-0
CarBulletAni.ts.meta
assets/scripts/scenes/scenePlay/CarBulletAni.ts.meta
+1
-0
CarShootAni.ts
assets/scripts/scenes/scenePlay/CarShootAni.ts
+26
-0
CarShootAni.ts.meta
assets/scripts/scenes/scenePlay/CarShootAni.ts.meta
+1
-0
.DS_Store
assets/sheets/.DS_Store
+0
-0
子弹-1.png
assets/sheets/play.sht/子弹-1.png
+0
-0
MustCompile.ts
src/generated/MustCompile.ts
+38
-32
No files found.
assets/prefabs/bullet.pfb
View file @
c5423766
...
...
@@ -21,7 +21,8 @@
},
{
"script": "./scripts/scenes/BulletItem",
"properties": {}
"properties": {},
"disabled": false
}
],
"children": [
...
...
assets/scenes/main.scene
View file @
c5423766
...
...
@@ -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
}
]
},
...
...
assets/scripts/scenes/ScenePlay.ts
View file @
c5423766
...
...
@@ -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();
...
...
assets/scripts/scenes/scenePlay.meta
0 → 100644
View file @
c5423766
{"ver":"1.0.1","uuid":"78241f13-a5ce-4eb9-8455-97ff2004f0e2","subMetas":{},"isGroup":true}
assets/scripts/scenes/scenePlay/CarBulletAni.ts
0 → 100644
View file @
c5423766
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
);
}
}
assets/scripts/scenes/scenePlay/CarBulletAni.ts.meta
0 → 100644
View file @
c5423766
{"ver":"1.0.1","uuid":"8525cc2b-6dbc-4f0e-9fe1-256a2811c705","subMetas":{},"type":"script"}
assets/scripts/scenes/scenePlay/CarShootAni.ts
0 → 100644
View file @
c5423766
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
;
}
}
}
assets/scripts/scenes/scenePlay/CarShootAni.ts.meta
0 → 100644
View file @
c5423766
{"ver":"1.0.1","uuid":"e78ad988-e1f0-4505-a1c7-8d40b26790c2","subMetas":{},"type":"script"}
assets/sheets/.DS_Store
View file @
c5423766
No preview for this file type
assets/sheets/play.sht/子弹-1.png
View replaced file @
32f4104c
View file @
c5423766
1.36 KB
|
W:
|
H:
3.52 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/generated/MustCompile.ts
View file @
c5423766
...
...
@@ -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/RectRender
er'
;
registerDef
(
'components/
renderer/RectRender
er'
,
component6
);
import
component6
from
'components/
other/CameraControll
er'
;
registerDef
(
'components/
other/CameraControll
er'
,
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
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment