Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
ngt06_ball
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
ngt06_ball
Commits
b9273da3
Commit
b9273da3
authored
Nov 02, 2022
by
yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11.2调整
parent
2354ccff
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
422 additions
and
221 deletions
+422
-221
bullet.ts
assets/ngt06_ball/scene/bullet.ts
+2
-2
ngt06_ball.fire
assets/ngt06_ball/scene/ngt06_ball.fire
+366
-203
ngt06_ball.ts
assets/ngt06_ball/scene/ngt06_ball.ts
+53
-15
Game.ts
assets/ngt06_ball/scene/tool/Game.ts
+1
-1
No files found.
assets/ngt06_ball/scene/bullet.ts
View file @
b9273da3
...
...
@@ -23,7 +23,7 @@ export default class Clund_06 extends cc.Component {
});
pg
.
event
.
on
(
"
stop_shoot
"
,
()
=>
{
this
.
node
.
x
=
0
;
this
.
node
.
y
=
-
542
;
//
this.node.y = -542;
this
.
node
.
angle
=
0
;
this
.
runShoot
=
false
;
})
...
...
@@ -34,7 +34,7 @@ export default class Clund_06 extends cc.Component {
protected
update
(
dt
)
{
if
(
!
this
.
runShoot
)
return
;
//子弹位移
let
speed
=
10
;
let
speed
=
25
;
let
nextPos
=
this
.
angleAndDistance2Point
(
this
.
jAngle
,
speed
);
this
.
node
.
x
+=
nextPos
.
x
;
this
.
node
.
y
+=
nextPos
.
y
;
...
...
assets/ngt06_ball/scene/ngt06_ball.fire
View file @
b9273da3
This diff is collapsed.
Click to expand it.
assets/ngt06_ball/scene/ngt06_ball.ts
View file @
b9273da3
...
...
@@ -64,6 +64,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
onLoadEnd
()
{
cc
.
macro
.
ENABLE_MULTI_TOUCH
=
false
;
//禁用多指操作
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this
.
initData
();
this
.
initView
();
...
...
@@ -118,7 +119,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
btn_next
=
cc
.
find
(
"
layout_finish/btn_next
"
,
this
.
node
);
btn_again
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onAgain
,
this
);
btn_next
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onNext
,
this
);
cc
.
find
(
"
btn_touch
"
,
this
.
layout_game
).
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onLayoutTouch
,
this
);
let
btn_touch
=
cc
.
find
(
"
btn_touch
"
,
this
.
layout_game
);
btn_touch
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onLayoutTouch
,
this
);
btn_touch
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onLayoutStart
,
this
);
btn_touch
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
this
.
onLayoutMove
,
this
);
cc
.
find
(
"
gong_touch
"
,
this
.
layout_game
).
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onGongBullet
,
this
);
pg
.
event
.
on
(
"
game_start
"
,
()
=>
{
this
.
gameStart
();
});
...
...
@@ -132,7 +137,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
// }
});
pg
.
event
.
on
(
"
bullet_reset_pos
"
,
()
=>
{
const
gameCanvas
=
cc
.
view
.
getVisibleSize
();
let
gameWidthX
=
gameCanvas
.
width
;
let
gameHeightX
=
gameCanvas
.
height
this
.
touching
=
false
;
this
.
gong_item
.
angle
=
0
;
this
.
jian_item
.
y
=
-
gameHeightX
/
2
-
30
;
});
}
private
resetGame
()
{
...
...
@@ -155,15 +165,32 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
private
onLayoutTouch
(
e
)
{
if
(
this
.
touching
)
return
;
this
.
touching
=
true
;
this
.
gongAngle
(
e
)
}
private
onLayoutStart
(
e
)
{
this
.
gongAngle
(
e
)
}
private
onLayoutMove
(
e
)
{
this
.
gongAngle
(
e
)
}
private
gongAngle
(
e
)
{
this
.
jian_item
.
angle
=
0
;
let
point
=
e
.
touch
.
getLocation
();
let
jp
=
cc
.
v2
(
point
.
x
-
this
.
layout_balloon
.
width
/
2
,
point
.
y
-
this
.
layout_balloon
.
height
/
2
);
let
lefP
=
cc
.
v2
(
0
,
-
542
);
let
angle
=
this
.
getDegree
(
lefP
,
jp
);
// this.jian_item.angle = angle;
if
(
angle
>
80
)
angle
=
80
;
if
(
angle
<
-
80
)
angle
=
-
80
;
this
.
gong_item
.
angle
=
angle
;
this
.
jian_item
.
angle
=
angle
;
}
private
onGongBullet
()
{
if
(
this
.
touching
)
return
;
this
.
touching
=
true
;
let
angle
=
this
.
jian_item
.
angle
;
this
.
playLocalAudio
(
"
gShow
"
);
pg
.
event
.
emit
(
"
bullet_shoot
"
,
angle
);
}
private
gameOver
()
{
...
...
@@ -185,7 +212,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
lastCount
=
null
;
this
.
touchFishs
=
[];
this
.
layout_balloon
.
removeAllChildren
();
this
.
playLocalAudio
(
"
gShow
"
);
this
.
showEnter
().
then
(()
=>
{
this
.
showQuestion
();
});
...
...
@@ -203,9 +229,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
gong_item
.
y
=
-
900
;
this
.
jian_item
.
y
=
-
900
;
return
new
Promise
((
resolve
,
reject
)
=>
{
cc
.
tween
(
this
.
gong_item
).
to
(
0.5
,
{
y
:
-
gameHeightX
/
2
+
30
})
cc
.
tween
(
this
.
gong_item
).
to
(
0.5
,
{
y
:
-
gameHeightX
/
2
-
30
})
.
call
(()
=>
{
cc
.
tween
(
this
.
jian_item
).
to
(
0.5
,
{
y
:
-
gameHeightX
/
2
}).
start
();
cc
.
tween
(
this
.
jian_item
).
to
(
0.5
,
{
y
:
-
gameHeightX
/
2
-
30
}).
start
();
pg
.
audio
.
playAudioByUrl
(
question
.
audio
);
cc
.
tween
(
this
.
gong_word
).
to
(
0.3
,
{
opacity
:
255
,
scale
:
1
})
.
call
(()
=>
{
...
...
@@ -279,7 +305,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
update
(
dt
)
{
if
(
Game
.
getIns
().
state
!=
GAME_STATE
.
RUNNING
)
return
;
// if (this.touching) return;
if
(
this
.
fishLen
<
5
)
this
.
count
++
;
if
(
this
.
fishLen
<
6
)
this
.
count
++
;
let
fish
=
this
.
getFishByCount
(
this
.
count
);
if
(
fish
)
this
.
fishs
.
push
(
fish
);
this
.
isHitBalloon
();
...
...
@@ -288,8 +314,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
!
this
.
touching
)
return
;
this
.
fishs
.
forEach
((
item
)
=>
{
let
dis
=
this
.
getDistances
(
this
.
jian_item
,
item
);
if
(
dis
<
1
5
0
&&
item
.
data
.
fish
.
isOut
==
FISH_OUT
.
RUNNING
)
{
if
(
item
.
x
<
200
&&
item
.
x
>
-
200
&&
item
.
y
<
-
3
5
0
)
return
;
if
(
dis
<
1
6
0
&&
item
.
data
.
fish
.
isOut
==
FISH_OUT
.
RUNNING
)
{
if
(
item
.
x
<
200
&&
item
.
x
>
-
200
&&
item
.
y
<
-
3
0
0
)
return
;
pg
.
event
.
emit
(
"
stop_shoot
"
);
cc
.
Tween
.
stopAllByTarget
(
item
);
let
state
=
item
.
data
.
right
?
FISH_STATE
.
BREAK
:
FISH_STATE
.
FALL
;
...
...
@@ -318,7 +344,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg
.
view
.
visible
(
pg
.
view
.
find
(
item
,
'
bomb
'
),
true
);
this
.
schedule
(()
=>
{
item
.
active
=
false
;
},
1
);
},
0.4
);
resolve
(
''
);
break
;
case
FISH_STATE
.
FALL
:
...
...
@@ -341,7 +367,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
updateFish
(
item
,
data
:
Option
)
{
// pg.view.touchOn(item, this.onTouchItem, this);
if
(
!
this
.
fishCount
)
this
.
fishCount
=
0
;
let
id
=
this
.
fishCount
%
5
+
1
;
let
id
=
this
.
fishCount
%
6
;
this
.
fishCount
++
;
// let res = pg.view.find(item, 'res');
...
...
@@ -368,15 +394,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
let
pos
=
[
-
794
,
-
480
,
-
160
,
155
,
473
,
798
];
item
.
parent
=
this
.
layout_balloon
;
item
.
data
=
data
;
data
.
fish
.
node
=
item
;
//x y 起始点 和终点 进行 随机
cc
.
Tween
.
stopAllByTarget
(
item
);
//左往右
item
.
x
=
-
1334
/
2
+
Math
.
random
()
*
1334
;
item
.
y
=
-
(
7
20
/
2
+
Math
.
random
()
*
400
);
//
cc
.
tween
(
item
).
to
(
7
+
Math
.
random
()
*
6
,
{
y
:
15
00
}).
call
(()
=>
{
item
.
x
=
pos
[
id
];
//
-1334 / 2 + Math.random() * 1334;
item
.
y
=
-
(
7
00
+
Math
.
random
()
*
400
);
//
cc
.
tween
(
item
).
to
(
4
+
Math
.
random
()
*
5
,
{
y
:
10
00
}).
call
(()
=>
{
data
.
fish
.
isOut
=
FISH_OUT
.
OUT
;
this
.
viewFishs
=
this
.
viewFishs
.
filter
(
v
=>
v
.
id
!=
data
.
id
);
}).
start
();
...
...
@@ -540,3 +567,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
/**
* NGT06分类气球
1. 发射过程,不是点击气球,而是点击弓,然后释放弓,按角度发射箭;
2. 弓应该是旋转的,我给过示意图;
3. 弓上的字体需要加粗,看效果图;
4. 箭的速度太慢了,看我给的视频例子,这个速度就好;
5. 箭发出应该有音效;
6. 气球爆炸的图片停留的时间太久的,停留0.5秒,一闪而过就好;
7. 气球总是扎堆,需要左右分离一些留一些距离;(不是从左侧扎堆,就是从右侧扎堆)
*/
\ No newline at end of file
assets/ngt06_ball/scene/tool/Game.ts
View file @
b9273da3
...
...
@@ -28,7 +28,7 @@ export class Option {
public
touchRight
:
boolean
;
public
parent
;
public
pairKey
;
fish
:
any
;
public
fish
:
any
;
constructor
(
data
,
id
)
{
this
.
id
=
id
;
this
.
type
=
data
.
type
;
...
...
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