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
cefdabe2
Commit
cefdabe2
authored
Jun 10, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ae125ad5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
24 deletions
+79
-24
.scilla
.scilla
+1
-1
RocketItem.ts
assets/scripts/scenes/RocketItem.ts
+3
-4
ScenePlay.ts
assets/scripts/scenes/ScenePlay.ts
+2
-3
BallManager.ts
assets/scripts/scenes/scenePlay/BallManager.ts
+5
-5
DropManager.ts
assets/scripts/scenes/scenePlay/DropManager.ts
+39
-11
drops.ts
assets/scripts/scenes/scenePlay/drops.ts
+28
-0
drops.ts.meta
assets/scripts/scenes/scenePlay/drops.ts.meta
+1
-0
No files found.
.scilla
View file @
cefdabe2
{"currentScene":"assets/scenes/main.scene"}
\ No newline at end of file
{"currentScene":"assets/prefabs/BlueRocket.pfb"}
\ No newline at end of file
assets/scripts/scenes/RocketItem.ts
View file @
cefdabe2
...
...
@@ -7,9 +7,9 @@ export default class RocketItem extends Body {
text
:
Entity
;
constructor
()
{
super
();
this
.
gravity
=
1
.5
;
this
.
bounceY
=
0.
6
;
this
.
velocityX
=
1
;
this
.
rotationSpeed
=
0
;
this
.
gravity
=
.
5
;
this
.
bounceY
=
0.
4
;
this
.
rotationSpeed
=
0
;
}
onAwake
()
{
...
...
@@ -19,7 +19,6 @@ export default class RocketItem extends Body {
reset
()
{
super
.
reset
();
this
.
velocityX
=
1
;
this
.
rotationSpeed
=
0
;
}
...
...
assets/scripts/scenes/ScenePlay.ts
View file @
cefdabe2
...
...
@@ -141,7 +141,7 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
getBulletStren
()
{
return
Math
.
floor
(
this
.
_carFire
/
100
);
}
checkBallSplit
(
ball
:
BallItem
)
{
this
.
_ballManager
.
checkBallSplit
(
ball
);
this
.
_ballManager
.
checkBallSplit
(
ball
,
this
.
_carBullet
,
this
.
_carFire
);
}
checkBallCollideGroud
()
{
...
...
@@ -203,8 +203,7 @@ export default class ScenePlay extends InteractComponent implements INavigatorVi
this
.
_dropManager
=
this
.
getComponent
(
DropManager
);
}
this
.
score
=
0
;
this
.
_carBullet
=
15
;
// this._carBullet = 0;
this
.
_carBullet
=
0
;
this
.
_carFire
=
100
;
this
.
_bulletManager
.
updateLines
(
this
.
_carBullet
);
this
.
updateScoreTxt
();
...
...
assets/scripts/scenes/scenePlay/BallManager.ts
View file @
cefdabe2
...
...
@@ -2,11 +2,11 @@ import { getTween } from 'assets/scripts/getTween';
import
{
getX
,
getY
,
setScale
,
setXY
}
from
'assets/scripts/transformUtils'
;
import
ScillaComponent
from
'components/base/ScillaComponent'
;
import
{
Transform
}
from
'scilla-components/src'
;
import
{
Entity
,
instantiate
,
resource
,
createTween
,
ease
,
ColorMatrixFilter
}
from
'scilla/src'
;
import
{
Entity
,
instantiate
,
resource
}
from
'scilla/src'
;
import
BallItem
,
{
BallSizeType
,
BallSizeTypeList
}
from
'../BallItem'
;
import
{
pickFromList
,
removeFromList
}
from
'../_'
;
import
{
removeFromList
}
from
'../_'
;
import
{
getBallScore
,
getBallScoreRange
}
from
'./ballScore'
;
import
{
randomColorIndex
}
from
'./colors'
;
import
{
getBallScoreRange
,
getBallScore
}
from
'./ballScore'
;
import
{
getNextScore
}
from
'./getNextScore'
;
const
getN
=
(
carBullet
)
=>
{
...
...
@@ -73,7 +73,7 @@ export default class BallManager extends ScillaComponent {
this
.
_idCounter
=
1
;
}
checkBallSplit
(
ball
:
BallItem
)
{
checkBallSplit
(
ball
:
BallItem
,
bullet
,
fire
)
{
//移除ball
ball
.
enabled
=
false
;
removeFromList
(
ball
,
this
.
ballList
);
...
...
@@ -89,7 +89,7 @@ export default class BallManager extends ScillaComponent {
ball1
.
velocityX
=
-
5
;
ball2
.
velocityX
=
5
;
}
else
{
//掉落
this
.
broadcast
(
'createDrop'
,
1
,
ball
)
this
.
broadcast
(
'createDrop'
,
1
,
ball
,
bullet
,
fire
)
}
}
...
...
assets/scripts/scenes/scenePlay/DropManager.ts
View file @
cefdabe2
...
...
@@ -7,6 +7,9 @@ import Body from '../Body';
import
RocketItem
from
'../RocketItem'
;
import
{
removeFromList
}
from
'../_'
;
import
{
DropType
}
from
'./DropType'
;
import
{
initEnv
}
from
'assets/scripts/common/BuriedPoint'
;
import
{
getProp
,
dropsCls
}
from
'./drops'
;
import
getPropItem
from
'./getPropItem'
;
export
default
class
DropManager
extends
ScillaComponent
{
RedFirePrefab
:
resource
;
...
...
@@ -46,19 +49,44 @@ export default class DropManager extends ScillaComponent {
setAlpha
(
drop
,
1
);
}
createDrop
(
ball
:
Body
)
{
let
item
:
Body
;
if
(
Math
.
random
()
>
0.7
)
{
item
=
this
.
getFireItem
(
this
.
BlueRocketPrefab
,
DropType
.
blue
);
createDrop
(
ball
:
Body
,
carbullet
,
fire
)
{
const
dropinfo
=
getProp
(
carbullet
);
const
dropsData
:
DropType
[]
=
getPropItem
(
dropsCls
,
dropinfo
.
p
,
dropinfo
.
n
);
const
[
d1
,
d2
,
d3
]
=
dropsData
;
let
n
=
dropsData
.
length
;
// console.log(dropsData)
const
p
=
30
;
let
dir
=
1
;
if
(
getX
(
ball
)
>
0
)
dir
=
-
1
;
const
x
=
getX
(
ball
),
y
=
getY
(
ball
);
const
baseVx
=
dir
*
1
;
if
(
n
==
3
)
{
const
item1
=
this
.
createDropItem
(
d1
,
ball
,
x
,
y
,
baseVx
-
dir
);
const
item2
=
this
.
createDropItem
(
d2
,
ball
,
x
+
dir
*
p
,
y
-
p
,
baseVx
);
const
item3
=
this
.
createDropItem
(
d3
,
ball
,
x
+
dir
*
p
*
2
,
y
-
p
*
2
,
baseVx
+
dir
);
}
else
if
(
n
==
2
)
{
const
item1
=
this
.
createDropItem
(
d1
,
ball
,
x
,
y
,
baseVx
);
const
item2
=
this
.
createDropItem
(
d2
,
ball
,
x
+
dir
*
p
,
y
-
p
,
baseVx
+
dir
);
}
else
{
if
(
Math
.
random
()
>
0.7
)
item
=
this
.
getFireItem
(
this
.
RedFirePrefab
,
DropType
.
red
);
else
if
(
Math
.
random
()
>
0.3
)
item
=
this
.
getFireItem
(
this
.
YellowRocketPrefab
,
DropType
.
yellow
);
else
item
=
this
.
getFireItem
(
this
.
PurpleRocketPrefab
,
DropType
.
purple
);
const
item1
=
this
.
createDropItem
(
d1
,
ball
,
x
,
y
,
baseVx
);
}
}
getPrefab
(
dropType
:
DropType
)
{
if
(
dropType
==
DropType
.
blue
)
return
this
.
BlueRocketPrefab
;
if
(
dropType
==
DropType
.
purple
)
return
this
.
PurpleRocketPrefab
;
if
(
dropType
==
DropType
.
red
)
return
this
.
RedFirePrefab
;
if
(
dropType
==
DropType
.
yellow
)
return
this
.
YellowRocketPrefab
;
}
private
createDropItem
(
dropType
:
DropType
,
ball
:
Body
,
x
:
number
,
y
:
number
,
vx
)
{
let
item
:
Body
;
item
=
this
.
getFireItem
(
this
.
getPrefab
(
dropType
),
dropType
);
setXY
(
item
,
getX
(
ball
),
getY
(
ball
));
item
.
velocityY
=
-
Math
.
abs
(
vx
)
*
3
*
2
;
item
.
velocityX
=
vx
*
3
;
return
item
;
}
...
...
@@ -82,7 +110,7 @@ export default class DropManager extends ScillaComponent {
private
_dropList
:
RocketItem
[]
=
[];
get
dropList
()
{
return
this
.
_dropList
}
private
_freeDic
:
{
[
key
:
string
]:
RocketItem
[];
}
=
{
'red'
:
[],
'blue'
:
[],
'purple'
:
[],
'yellow'
:
[]
'red'
:
[],
'blue'
:
[],
'purple'
:
[],
'yellow'
:
[]
};
oncreate
()
{
...
...
assets/scripts/scenes/scenePlay/drops.ts
0 → 100644
View file @
cefdabe2
import
{
DropType
}
from
"./DropType"
;
//////////////////////// 1 30% 20% 10%
export
const
dropsCls
=
[
DropType
.
blue
,
DropType
.
red
,
DropType
.
purple
,
DropType
.
yellow
];
export
const
dropsData
=
[{
bullet
:
1
},
{
fire
:
30
},
{
fire
:
20
},
{
fire
:
10
}];
export
const
getIndex
=
(
cls
)
=>
dropsCls
.
indexOf
(
cls
);
export
const
getProp
=
(
X
:
number
)
=>
{
if
(
X
<=
30
)
{
return
{
n
:
3
,
p
:
window
[
'drop-p-30'
]
||
[
40
,
0
,
15
,
50
]
}
}
if
(
X
>
30
&&
X
<
70
)
{
return
{
n
:
2
,
p
:
window
[
'drop-p-30-70'
]
||
[
40
,
5
,
15
,
50
]
}
}
if
(
X
>=
70
)
{
return
{
n
:
1
,
p
:
window
[
'drop-p-70'
]
||
[
40
,
5
,
15
,
50
]
}
}
}
\ No newline at end of file
assets/scripts/scenes/scenePlay/drops.ts.meta
0 → 100644
View file @
cefdabe2
{"ver":"1.0.1","uuid":"2648271f-74ba-485c-96c8-24cd46fac8dc","subMetas":{},"type":"script"}
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