Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy11_paopao
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
hy11_paopao
Commits
82e98919
Commit
82e98919
authored
Jun 23, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动画逻辑分离
parent
ea2c7a4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
22 deletions
+37
-22
hy01_danci.ts
assets/hy01_danci/scene/hy01_danci.ts
+37
-22
No files found.
assets/hy01_danci/scene/hy01_danci.ts
View file @
82e98919
...
...
@@ -68,41 +68,56 @@ export default class SceneComponent extends MyCocosSceneComponent {
return
this
.
data
.
questions
[
this
.
current
];
}
// 制造气泡
create_bubbles
()
{
async
create_bubbles
()
{
if
(
this
.
touchNumber
>
this
.
currentQuestion
.
options
.
length
)
{
console
.
log
(
'
此题结束
'
)
}
else
{
let
bottom_megaphone
=
pg
.
view
.
find
(
this
,
'
layer_game/bottom_megaphone
'
)
let
layer_paopao
=
pg
.
view
.
find
(
this
,
'
layer_game/layer_paopao
'
)
let
paoaoParent
=
pg
.
view
.
find
(
this
,
'
layer_game/paopao
'
)
// 创建泡泡
let
newPaoPao
=
cc
.
instantiate
(
paoaoParent
)
layer_paopao
.
addChild
(
newPaoPao
)
this
.
updatePaoPao
(
newPaoPao
,
this
.
currentQuestion
.
options
[
this
.
touchNumber
-
1
]);
let
btn
=
cc
.
tween
(
bottom_megaphone
)
btn
.
to
(
0.1
,
{
x
:
-
5
}).
to
(
0.1
,
{
x
:
0
}).
to
(
0.1
,
{
x
:
5
}).
to
(
0.1
,
{
x
:
0
})
btn
.
to
(
0.1
,
{
x
:
-
5
}).
to
(
0.1
,
{
x
:
0
}).
to
(
0.1
,
{
x
:
5
}).
to
(
0.1
,
{
x
:
0
})
.
call
(()
=>
{
newPaoPao
.
x
=
135
newPaoPao
.
y
=
-
450
newPaoPao
.
opacity
=
0
pg
.
view
.
visible
(
newPaoPao
,
true
)
cc
.
tween
(
newPaoPao
).
to
(
0.8
,
{
opacity
:
255
}).
call
(()
=>
{
let
positionY
=
Math
.
floor
(
Math
.
random
()
*
300
)
let
positionX
=
this
.
getPositionX
()
this
.
targetPosition
=
positionY
cc
.
tween
(
newPaoPao
).
to
(
positionY
/
this
.
speed
,
{
x
:
positionX
,
y
:
positionY
,
scale
:
3
}).
call
(()
=>
{
if
(
newPaoPao
.
y
<
cc
.
winSize
.
height
+
105
)
{
cc
.
tween
(
newPaoPao
).
to
((
750
-
newPaoPao
.
y
)
/
this
.
speed
,
{
y
:
cc
.
winSize
.
height
+
105
}).
call
(()
=>
{
newPaoPao
.
destroy
()
}).
start
()
}
}).
start
()
}).
start
()
// 做动画
this
.
aniShake
(
bottom_megaphone
).
then
(()
=>
{
this
.
aniPaoPaoFly
(
newPaoPao
).
then
(()
=>
{
// 泡泡自行销毁
newPaoPao
.
parent
=
null
;
})
btn
.
start
(
)
}
)
}
this
.
touchNumber
++
;
}
aniPaoPaoFly
(
item
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
pg
.
view
.
visible
(
item
,
true
)
item
.
x
=
135
item
.
y
=
-
450
item
.
opacity
=
0
let
positionY
=
Math
.
floor
(
Math
.
random
()
*
300
)
let
positionX
=
this
.
getPositionX
()
cc
.
tween
(
item
).
to
(
0.8
,
{
opacity
:
255
})
.
call
(()
=>
{
this
.
targetPosition
=
positionY
})
.
to
(
positionY
/
this
.
speed
,
{
x
:
positionX
,
y
:
positionY
,
scale
:
3
})
.
to
((
750
-
item
.
y
)
/
this
.
speed
,
{
y
:
cc
.
winSize
.
height
+
105
})
.
call
(()
=>
{
resolve
(
''
);
}).
start
()
});
}
aniShake
(
item
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
cc
.
tween
(
item
)
.
to
(
0.1
,
{
x
:
-
5
}).
to
(
0.1
,
{
x
:
0
}).
to
(
0.1
,
{
x
:
5
}).
to
(
0.1
,
{
x
:
0
})
.
to
(
0.1
,
{
x
:
-
5
}).
to
(
0.1
,
{
x
:
0
}).
to
(
0.1
,
{
x
:
5
}).
to
(
0.1
,
{
x
:
0
})
.
call
(()
=>
{
resolve
(
''
);
}).
start
()
});
}
updatePaoPao
(
item
,
data
)
{
let
paopao
=
item
.
getChildByName
(
"
bubble
"
)
let
broken
=
item
.
getChildByName
(
"
bubble_broken
"
)
...
...
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