Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
ngt10_tydh
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
ngt10_tydh
Commits
840f4ea2
Commit
840f4ea2
authored
Oct 15, 2022
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NGT10提交
parent
e67f3f18
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
844 additions
and
845 deletions
+844
-845
box2d.ts
assets/cocos_generator/scene/box2d.ts
+45
-50
ngt10_tydh.fire
assets/cocos_generator/scene/ngt10_tydh.fire
+781
-783
ngt10_tydh.ts
assets/cocos_generator/scene/ngt10_tydh.ts
+17
-12
creator.d.ts
creator.d.ts
+1
-0
No files found.
assets/cocos_generator/scene/box2d.ts
View file @
840f4ea2
...
@@ -5,32 +5,21 @@
...
@@ -5,32 +5,21 @@
// Learn life-cycle callbacks:
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
pg
from
"
./tool/pg
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
@
ccclass
export
default
class
Box2d
extends
cc
.
Component
{
export
default
class
Box2d
extends
cc
.
Component
{
@
property
(
cc
.
Label
)
label
:
cc
.
Label
=
null
;
@
property
text
:
string
=
'
hello
'
;
// LIFE-CYCLE CALLBACKS:
// LIFE-CYCLE CALLBACKS:
private
layout_item
:
cc
.
Node
;
private
layout_item
:
cc
.
Node
;
onLoad
()
{
onLoad
()
{
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getPhysicsManager
().
debugDrawFlags
=
// cc.director.getPhysicsManager().debugDrawFlags = cc.PhysicsManager.DrawBits.e_jointBit | cc.PhysicsManager.DrawBits.e_shapeBit;
// cc.PhysicsManager.DrawBits.e_aabbBit |
cc
.
director
.
getPhysicsManager
().
debugDrawFlags
=
0
;
// cc.PhysicsManager.DrawBits.e_pairBit |
// cc.PhysicsManager.DrawBits.e_centerOfMassBit |
cc
.
PhysicsManager
.
DrawBits
.
e_jointBit
|
cc
.
PhysicsManager
.
DrawBits
.
e_shapeBit
;
// cc.director.getPhysicsManager().gravity = cc.v2(0, -320);
cc
.
director
.
getPhysicsManager
().
gravity
=
cc
.
v2
(
0
,
-
640
);
cc
.
director
.
getPhysicsManager
().
gravity
=
cc
.
v2
(
0
,
-
640
);
// 开启物理步长的设置
// 开启物理步长的设置
var
manager
=
cc
.
director
.
getPhysicsManager
();
var
manager
=
cc
.
director
.
getPhysicsManager
();
manager
.
enabledAccumulator
=
true
;
manager
.
enabledAccumulator
=
true
;
...
@@ -41,41 +30,37 @@ export default class Box2d extends cc.Component {
...
@@ -41,41 +30,37 @@ export default class Box2d extends cc.Component {
// 每次更新物理系统处理位置的迭代次数,默认为 10
// 每次更新物理系统处理位置的迭代次数,默认为 10
cc
.
PhysicsManager
.
POSITION_ITERATIONS
=
8
;
cc
.
PhysicsManager
.
POSITION_ITERATIONS
=
8
;
// setTimeout(() => {
// let item = this.node.getChildByName("item2")
// let rigid = item.getComponent(cc.RigidBody)
// rigid.linearVelocity = cc.v2(-100, 0)
// }, 1500);
this
.
layout_item
=
this
.
node
.
getChildByName
(
'
layout_item
'
)
this
.
layout_item
=
this
.
node
.
getChildByName
(
'
layout_item
'
)
this
.
initOrange
();
// setTimeout(() => {
pg
.
event
.
on
(
"
box2d_init
"
,
(
len
:
number
)
=>
{
// this.jumpOrange();
let
arr
=
[];
// }, 1000);
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
// setTimeout(() => {
arr
.
push
(
100
+
i
);
// this.jumpOrange();
}
// }, 6000);
this
.
initOrange
(
arr
);
// setTimeout(() => {
})
// this.jumpOrange();
pg
.
event
.
on
(
"
box2d_next
"
,
()
=>
{
// }, 11000);
this
.
jumpOrange
();
// setTimeout(() => {
})
// this.jumpOrange();
pg
.
event
.
on
(
"
box2d_roll
"
,
()
=>
{
// }, 16000);
this
.
jumpRoll
();
// setTimeout(() => {
})
// this.jumpOrange();
pg
.
event
.
on
(
"
box2d_hide
"
,
()
=>
{
// }, 21000);
this
.
hideJump
();
// setTimeout(() => {
})
// this.jumpRoll();
// }, 26000);
}
}
current
:
number
;
current
:
number
;
initOrange
()
{
ids
:
Array
<
number
>
;
jumpedNodes
:
Array
<
cc
.
Node
>
;
initOrange
(
ids
=
[
101
,
102
,
103
,
104
,
105
])
{
this
.
current
=
0
;
this
.
jumpedNodes
=
[];
this
.
ids
=
ids
.
concat
();
this
.
layout_item
.
removeAllChildren
();
this
.
layout_item
.
removeAllChildren
();
let
item
=
this
.
node
.
getChildByName
(
"
item
"
);
let
item
=
this
.
node
.
getChildByName
(
"
item
"
);
let
p0
=
cc
.
v2
(
-
320
,
305
);
let
p0
=
cc
.
v2
(
-
320
,
305
);
let
pSpace
=
cc
.
v2
(
120
,
0
)
let
pSpace
=
cc
.
v2
(
120
,
0
)
let
ids
=
[
101
,
102
,
103
,
104
,
105
]
this
.
current
=
0
;
for
(
let
i
=
0
;
i
<
ids
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
ids
.
length
;
i
++
)
{
let
node
=
cc
.
instantiate
(
item
);
let
node
=
cc
.
instantiate
(
item
);
node
.
active
=
true
;
node
.
active
=
true
;
...
@@ -89,13 +74,12 @@ export default class Box2d extends cc.Component {
...
@@ -89,13 +74,12 @@ export default class Box2d extends cc.Component {
return
this
.
layout_item
.
children
.
filter
(
node
=>
ids
.
some
(
id
=>
id
==
node
.
data
))
return
this
.
layout_item
.
children
.
filter
(
node
=>
ids
.
some
(
id
=>
id
==
node
.
data
))
}
}
jumpOrange
()
{
jumpOrange
()
{
this
.
current
;
let
baffle
=
this
.
node
.
getChildByName
(
'
baffle
'
)
let
baffle
=
this
.
node
.
getChildByName
(
'
baffle
'
)
baffle
.
active
=
false
;
baffle
.
active
=
false
;
let
lid
=
this
.
node
.
getChildByName
(
'
lid
'
)
let
lid
=
this
.
node
.
getChildByName
(
'
lid
'
)
lid
.
active
=
false
;
lid
.
active
=
false
;
// 根据current来找橘子及后续的内容
// 根据current来找橘子及后续的内容
let
ids
=
[
101
,
102
,
103
,
104
,
105
]
.
concat
();
let
ids
=
this
.
ids
.
concat
();
let
jumping
:
any
=
[
ids
[
this
.
current
++
]];
let
jumping
:
any
=
[
ids
[
this
.
current
++
]];
let
moveing
:
any
=
[]
let
moveing
:
any
=
[]
for
(
let
i
=
this
.
current
;
i
<
ids
.
length
;
i
++
)
{
for
(
let
i
=
this
.
current
;
i
<
ids
.
length
;
i
++
)
{
...
@@ -105,37 +89,48 @@ export default class Box2d extends cc.Component {
...
@@ -105,37 +89,48 @@ export default class Box2d extends cc.Component {
moveing
=
this
.
findItemByIds
(
moveing
)
moveing
=
this
.
findItemByIds
(
moveing
)
jumping
.
forEach
(
node
=>
{
jumping
.
forEach
(
node
=>
{
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
200
,
0
)
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
200
,
0
)
this
.
jumpedNodes
.
push
(
node
);
})
})
moveing
.
forEach
(
node
=>
{
moveing
.
forEach
(
node
=>
{
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
100
,
0
)
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
100
,
0
)
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
// node.getComponent(cc.RigidBody).linearVelocity = cc.v2(0, 0)
baffle
.
active
=
true
;
baffle
.
active
=
true
;
},
1.2
)
node
.
getComponent
(
cc
.
RigidBody
).
linearDamping
=
2
},
1.3
)
})
})
setTimeout
(()
=>
{
pg
.
event
.
emit
(
"
box2d_next_successed
"
)
},
2000
);
}
}
jumpRoll
()
{
jumpRoll
()
{
let
lid
=
this
.
node
.
getChildByName
(
'
lid
'
)
let
lid
=
this
.
node
.
getChildByName
(
'
lid
'
)
lid
.
active
=
true
;
lid
.
active
=
true
;
this
.
layout_item
.
children
.
forEach
(
node
=>
{
let
list
=
this
.
jumpedNodes
;
list
.
forEach
(
node
=>
{
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
370
,
500
)
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
370
,
500
)
})
})
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
layout_item
.
children
.
forEach
(
node
=>
{
list
.
forEach
(
node
=>
{
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
370
,
500
)
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
370
,
500
)
})
})
},
1000
);
},
1000
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
layout_item
.
children
.
forEach
(
node
=>
{
list
.
forEach
(
node
=>
{
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
370
,
500
)
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
370
,
500
)
})
})
},
2000
);
},
2000
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
layout_item
.
children
.
forEach
(
node
=>
{
list
.
forEach
(
node
=>
{
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
370
,
500
)
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
cc
.
v2
(
-
370
,
500
)
})
})
setTimeout
(()
=>
{
pg
.
event
.
emit
(
"
box2d_roll_successed
"
)
},
1000
);
},
3000
);
},
3000
);
}
}
hideJump
()
{
this
.
jumpedNodes
.
forEach
(
node
=>
node
.
active
=
false
)
}
start
()
{
start
()
{
}
}
...
...
assets/cocos_generator/scene/ngt10_tydh.fire
View file @
840f4ea2
This diff is collapsed.
Click to expand it.
assets/cocos_generator/scene/ngt10_tydh.ts
View file @
840f4ea2
...
@@ -111,7 +111,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -111,7 +111,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
showQuestion
()
{
private
showQuestion
()
{
let
question
=
Game
.
getIns
().
getCurrentPage
();
let
question
=
Game
.
getIns
().
getCurrentPage
();
this
.
question_word
.
getComponent
(
cc
.
Label
).
string
=
question
.
text
;
this
.
question_word
.
getComponent
(
cc
.
Label
).
string
=
question
.
text
;
}
}
...
@@ -220,7 +219,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -220,7 +219,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
playLocalAudio
(
"
right
"
).
then
(()
=>
{
this
.
playLocalAudio
(
"
right
"
).
then
(()
=>
{
this
.
playLocalAudio
(
"
diaoluo
"
);
this
.
playLocalAudio
(
"
diaoluo
"
);
});
});
this
.
box2d
.
getComponent
(
Box2d
).
jumpOrange
();
pg
.
event
.
emit
(
"
box2d_next
"
)
pg
.
event
.
emit
(
"
mouse_10_add
"
);
pg
.
event
.
emit
(
"
mouse_10_add
"
);
}
else
{
}
else
{
this
.
playLocalAudio
(
"
error
"
).
then
(()
=>
{
this
.
playLocalAudio
(
"
error
"
).
then
(()
=>
{
...
@@ -250,16 +249,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -250,16 +249,20 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
checkRoundEnd
()
{
private
checkRoundEnd
()
{
Game
.
getIns
().
addPage
();
Game
.
getIns
().
addPage
();
if
(
!
Game
.
getIns
().
getCurrentPage
())
{
if
(
!
Game
.
getIns
().
getCurrentPage
())
{
// this.gameOver();
pg
.
event
.
on
(
"
box2d_roll_successed
"
,
()
=>
{
let
zjz_ske
=
cc
.
find
(
"
zjz_ske
"
,
this
.
node
);
pg
.
event
.
emit
(
"
box2d_hide
"
)
zjz_ske
.
active
=
true
;
// this.gameOver();
zjz_ske
.
getComponent
(
dragonBones
.
ArmatureDisplay
).
playAnimation
(
"
newAnimation
"
,
1
);
let
zjz_ske
=
cc
.
find
(
"
zjz_ske
"
,
this
.
node
);
zjz_ske
.
off
(
dragonBones
.
EventObject
.
COMPLETE
);
zjz_ske
.
active
=
true
;
this
.
playLocalAudio
(
"
zhazhi
"
);
zjz_ske
.
getComponent
(
dragonBones
.
ArmatureDisplay
).
playAnimation
(
"
newAnimation
"
,
1
);
zjz_ske
.
getComponent
(
dragonBones
.
ArmatureDisplay
).
on
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
zjz_ske
.
off
(
dragonBones
.
EventObject
.
COMPLETE
);
zjz_ske
.
active
=
false
;
this
.
playLocalAudio
(
"
zhazhi
"
);
this
.
showFind
();
zjz_ske
.
getComponent
(
dragonBones
.
ArmatureDisplay
).
on
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
},
this
);
zjz_ske
.
active
=
false
;
this
.
showFind
();
},
this
);
})
pg
.
event
.
emit
(
"
box2d_roll
"
)
}
else
{
}
else
{
this
.
playLocalAudio
(
"
next
"
);
this
.
playLocalAudio
(
"
next
"
);
this
.
record_word
.
getComponent
(
cc
.
Label
).
string
=
""
;
this
.
record_word
.
getComponent
(
cc
.
Label
).
string
=
""
;
...
@@ -290,6 +293,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -290,6 +293,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
private
initStart
()
{
private
initStart
()
{
//生成橘子
pg
.
event
.
emit
(
'
box2d_init
'
,
Game
.
getIns
().
getTotalPageNum
())
this
.
layout_start
.
active
=
true
;
this
.
layout_start
.
active
=
true
;
cc
.
find
(
"
layout_top/label_title
"
,
this
.
node
).
getComponent
(
cc
.
Label
).
string
=
Game
.
getIns
().
title
;
cc
.
find
(
"
layout_top/label_title
"
,
this
.
node
).
getComponent
(
cc
.
Label
).
string
=
Game
.
getIns
().
title
;
pg
.
event
.
emit
(
"
mouse_10_num
"
,
Game
.
getIns
().
total
);
pg
.
event
.
emit
(
"
mouse_10_num
"
,
Game
.
getIns
().
total
);
...
...
creator.d.ts
View file @
840f4ea2
...
@@ -4588,6 +4588,7 @@ declare namespace cc {
...
@@ -4588,6 +4588,7 @@ declare namespace cc {
/** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space.
/** !#en Returns a normalized vector representing the forward direction (Z axis) of the node in world space.
!#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
!#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
forward
:
Vec3
;
forward
:
Vec3
;
data
:
number
;
/**
/**
@param name name
@param name name
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