Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
unit_demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
unit_demo
Commits
5a6afb6e
Commit
5a6afb6e
authored
Mar 29, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增一个撒花效果
parent
420775d8
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2273 additions
and
2 deletions
+2273
-2
demo_01_showFireworks.fire
play/assets/tmpGame/scene/demo_01_showFireworks.fire
+1
-1
demo_03_fireworks_2.fire
play/assets/tmpGame/scene/demo_03_fireworks_2.fire
+2119
-0
demo_03_fireworks_2.fire.meta
play/assets/tmpGame/scene/demo_03_fireworks_2.fire.meta
+7
-0
demo_03_fireworks_2.js
play/assets/tmpGame/scene/demo_03_fireworks_2.js
+97
-0
demo_03_fireworks_2.js.meta
play/assets/tmpGame/scene/demo_03_fireworks_2.js.meta
+9
-0
mainPage.js
play/assets/tmpGame/scene/mainPage.js
+3
-0
runtime.js.meta
play/assets/tmpGame/script/runtime.js.meta
+1
-1
Img_paper.png
play/assets/tmpGame/textures/Img_paper.png
+0
-0
Img_paper.png.meta
play/assets/tmpGame/textures/Img_paper.png.meta
+36
-0
No files found.
play/assets/tmpGame/scene/demo_01_showFireworks.fire
View file @
5a6afb6e
...
@@ -177,7 +177,7 @@
...
@@ -177,7 +177,7 @@
"array": [
"array": [
0,
0,
0,
0,
7
91.54721905897
7,
7
00.83105801255
7,
0,
0,
0,
0,
0,
0,
...
...
play/assets/tmpGame/scene/demo_03_fireworks_2.fire
0 → 100644
View file @
5a6afb6e
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/scene/demo_03_fireworks_2.fire.meta
0 → 100644
View file @
5a6afb6e
{
"ver": "1.2.7",
"uuid": "960a9be8-b5a8-4ad7-8457-12d6f06588a2",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/demo_03_fireworks_2.js
0 → 100644
View file @
5a6afb6e
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
asyncDelay
,
RandomInt
}
from
"
../script/utils
"
;
cc
.
Class
({
extends
:
cc
.
Component
,
properties
:
{
},
start
()
{
this
.
initView
();
},
initView
()
{
const
bg
=
cc
.
find
(
'
Canvas/bg
'
);
bg
.
on
(
'
touchstart
'
,
async
(
event
)
=>
{
const
pos
=
bg
.
convertToNodeSpaceAR
(
event
.
getLocation
());
this
.
showOneFirework
(
pos
,
bg
,
cc
.
find
(
'
paperBase
'
).
children
);
});
const
btn
=
cc
.
find
(
'
Canvas/BtnShow
'
);
btn
.
on
(
'
click
'
,
()
=>
{
this
.
showAllFirework
(
bg
,
cc
.
find
(
'
paperBase
'
).
children
);
});
},
async
showOneFirework
(
pos
,
parentNode
,
nodeList
)
{
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
this
.
showFirework
(
pos
,
parentNode
,
nodeList
);
await
asyncDelay
(
0.1
);
}
},
async
showAllFirework
(
parentNode
,
nodeList
)
{
for
(
let
i
=
0
;
i
<
6
;
i
++
)
{
this
.
showFirework
(
cc
.
v2
(
0
,
-
parentNode
.
height
/
2
),
parentNode
,
nodeList
,
parentNode
.
width
*
1
,
parentNode
.
height
*
2
);
await
asyncDelay
(
0.1
);
}
},
showFirework
(
pos
,
parentNode
,
nodeList
,
width
=
200
,
height
=
200
)
{
for
(
let
i
=
0
;
i
<
30
;
i
++
)
{
const
quad
=
this
.
createQuads
(
pos
,
parentNode
,
nodeList
);
const
targetX
=
RandomInt
(
width
/
2
,
-
width
/
2
);
cc
.
tween
(
quad
)
.
to
(
5
,
{
x
:
pos
.
x
+
targetX
*
7
})
.
start
();
cc
.
tween
(
quad
)
.
to
(
0.5
,
{
y
:
pos
.
y
+
RandomInt
(
height
)
},
{
easing
:
'
quadOut
'
})
.
to
(
2
,
{
y
:
-
parentNode
.
height
*
2
},
{
easing
:
'
quadIn
'
})
.
removeSelf
()
.
start
();
}
},
createQuads
(
pos
,
parentNode
,
nodeList
)
{
const
quadBase
=
cc
.
instantiate
(
nodeList
[
RandomInt
(
nodeList
.
length
)]);
quadBase
.
x
=
pos
.
x
;
quadBase
.
y
=
pos
.
y
;
quadBase
.
z
=
pos
.
z
;
quadBase
.
angle
=
RandomInt
(
90
);
quadBase
.
parent
=
parentNode
;
const
quad
=
quadBase
.
getChildByName
(
'
quad
'
);
quad
.
x
=
0
;
quad
.
y
=
0
;
quad
.
angle
=
RandomInt
(
90
);
const
paper
=
quad
.
getChildByName
(
'
paper
'
);
paper
.
scaleX
=
Math
.
random
()
*
0.5
+
0.5
;
paper
.
scaleY
=
Math
.
random
()
*
0.5
+
0.5
;
quadBase
.
scaleX
=
Math
.
random
();
cc
.
tween
(
quadBase
)
.
to
((
1
-
quadBase
.
scaleX
)
*
0.3
,
{
scaleX
:
1
})
.
call
(()
=>
{
const
time
=
Math
.
random
()
*
0.2
;
cc
.
tween
(
quadBase
)
.
to
(
0.1
+
time
,
{
scaleX
:
-
1
})
.
to
(
0.1
+
time
,
{
scaleX
:
1
})
.
union
()
.
repeatForever
()
.
start
();
})
.
start
();
return
quadBase
;
},
});
play/assets/tmpGame/scene/demo_03_fireworks_2.js.meta
0 → 100644
View file @
5a6afb6e
{
"ver": "1.0.8",
"uuid": "29f1b6f8-b69f-4f93-91bd-97cf20d3c07f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/mainPage.js
View file @
5a6afb6e
...
@@ -44,6 +44,9 @@ cc.Class({
...
@@ -44,6 +44,9 @@ cc.Class({
},
{
},
{
sceneName
:
'
demo_02_scoreStars
'
,
sceneName
:
'
demo_02_scoreStars
'
,
label
:
'
星星
'
label
:
'
星星
'
},
{
sceneName
:
'
demo_03_fireworks_2
'
,
label
:
'
翻转撒花
'
}];
}];
demoList
.
forEach
((
demoItem
,
idx
)
=>
{
demoList
.
forEach
((
demoItem
,
idx
)
=>
{
...
...
play/assets/tmpGame/script/runtime.js.meta
View file @
5a6afb6e
{
{
"ver": "1.0.8",
"ver": "1.0.8",
"uuid": "d07c22c6-ea88-491a-8716-e509d7265361",
"uuid": "d07c22c6-ea88-491a-8716-e509d7265361",
"isPlugin":
fals
e,
"isPlugin":
tru
e,
"loadPluginInWeb": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"loadPluginInEditor": false,
...
...
play/assets/tmpGame/textures/Img_paper.png
0 → 100644
View file @
5a6afb6e
146 Bytes
play/assets/tmpGame/textures/Img_paper.png.meta
0 → 100644
View file @
5a6afb6e
{
"ver": "2.3.5",
"uuid": "5bd403c0-9676-4b25-8b82-b8bba1f11db1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 29,
"height": 29,
"platformSettings": {},
"subMetas": {
"Img_paper": {
"ver": "1.0.4",
"uuid": "9b6f7e88-adc2-446f-b791-1259c116637c",
"rawTextureUuid": "5bd403c0-9676-4b25-8b82-b8bba1f11db1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 29,
"height": 29,
"rawWidth": 29,
"rawHeight": 29,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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