Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
7687b148
Commit
7687b148
authored
Sep 21, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
01ff34fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
TestAsset.ts
egret/src/section2/TestAsset.ts
+13
-13
No files found.
egret/src/section2/TestAsset.ts
View file @
7687b148
...
...
@@ -8,6 +8,18 @@ export default class TestAsset extends StarterBase {
this
.
createGround
();
this
.
createBodies
();
this
.
createDebug
();
this
.
stage
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
addOneBox
,
this
);
}
private
addOneBox
(
e
:
egret
.
TouchEvent
):
void
{
var
positionX
:
number
=
Math
.
floor
(
e
.
stageX
);
var
positionY
:
number
=
Math
.
floor
(
e
.
stageY
);
if
(
Math
.
random
()
<
0.5
)
{
this
.
createBox
(
positionX
,
positionY
);
}
else
{
this
.
createDesk
(
positionX
,
positionY
);
}
}
private
createBodies
():
void
{
...
...
@@ -85,22 +97,10 @@ export default class TestAsset extends StarterBase {
var
stageHeight
:
number
=
this
.
stage
.
stageHeight
;
var
groundShape
:
p2
.
Plane
=
new
p2
.
Plane
();
var
groundBody
:
p2
.
Body
=
new
p2
.
Body
();
groundBody
.
position
[
1
]
=
1600
/
this
.
factor
;
groundBody
.
position
[
1
]
=
stageHeight
/
this
.
factor
;
groundBody
.
angle
=
Math
.
PI
;
groundBody
.
addShape
(
groundShape
);
this
.
world
.
addBody
(
groundBody
);
// let planeShape: p2.Plane = new p2.Plane();
// this.planeBody = new p2.Body({
// type: p2.Body.STATIC, //刚体类型
// position: [0, this.stage.stageHeight], //刚体的位置
// });
// this.planeBody.angle = Math.PI;//Plane相当于地面,默认面向Y轴方向。将地面翻转180度
// this.planeBody.displays = [];
// this.planeBody.addShape(planeShape);
// this.world.addBody(this.planeBody);
}
loop
():
void
{
...
...
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