Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
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
劳工
zeroing-libs
Commits
e2806289
Commit
e2806289
authored
Aug 11, 2020
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2533efe0
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
211 additions
and
147 deletions
+211
-147
p2demo.json
dist/customs/p2demo.json
+9
-3
app.js
src/custom/p2demo/debug/app.js
+1
-7
main.js
src/custom/p2demo/debug/main.js
+162
-127
main.js.map
src/custom/p2demo/debug/main.js.map
+1
-1
meta.json
src/custom/p2demo/meta.json
+8
-2
GameView.ts
src/custom/p2demo/src/game/GameView.ts
+30
-7
No files found.
dist/customs/p2demo.json
View file @
e2806289
This diff is collapsed.
Click to expand it.
src/custom/p2demo/debug/app.js
View file @
e2806289
...
...
@@ -46,13 +46,7 @@ function launchWithCustomModule(customModule) {
},
100
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
picUrl
:
"http://yun.duiba.com.cn/aurora/assets/e1593b97c27077b85b92f7eaaeae1ed64a1eb79a.png"
,
blockUrl
:
"888"
,
column
:
"2"
,
row
:
"2"
,
gameTime
:
"50"
});
engine
.
globalEvent
.
dispatchEvent
(
'pictures-start'
,
{
});
const
d
=
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
);
...
...
src/custom/p2demo/debug/main.js
View file @
e2806289
This diff is collapsed.
Click to expand it.
src/custom/p2demo/debug/main.js.map
View file @
e2806289
This diff is collapsed.
Click to expand it.
src/custom/p2demo/meta.json
View file @
e2806289
...
...
@@ -46,10 +46,16 @@
},
"assets"
:
[
{
"name"
:
"
遮罩
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
5b3e30496b2d9fdafb0cf3835fd6704ce10e45b4
.png"
,
"name"
:
"
block
"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
f91184b338ef9540b167eebe7d58e71402e8d9d9
.png"
,
"uuid"
:
"888"
,
"ext"
:
".png"
},
{
"name"
:
"ball"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3dc11f2d91659b7e7e1d06a9853cbc9f818e1ea2.png"
,
"uuid"
:
"999"
,
"ext"
:
".png"
}
],
"events"
:
{
...
...
src/custom/p2demo/src/game/GameView.ts
View file @
e2806289
import
{
Tool
}
from
"../../../seabed-game/src/game/Tools"
;
import
{
getTextureByName
}
from
"../../../answer-game/src/game/utils"
;
export
default
class
GameView
extends
engine
.
Container
{
world
:
p2
.
World
;
factor
:
number
=
10
;
isDebug
=
1
;
isDebug
=
0
;
constructor
()
{
super
();
this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
this
.
setup
,
this
);
...
...
@@ -20,6 +23,17 @@ export default class GameView extends engine.Container {
this
.
stage
.
addEventListener
(
engine
.
MouseEvent
.
CLICK
,
this
.
onClick
,
this
);
}
createBitmapByName
(
name
)
{
const
imgContainer
=
new
engine
.
Sprite
();
const
img
=
new
engine
.
Sprite
(
getTextureByName
(
name
));
img
.
anchorX
=
img
.
width
/
2
;
img
.
anchorY
=
img
.
height
/
2
;
img
.
x
=
-
img
.
width
/
2
;
img
.
y
=
-
img
.
height
/
2
;
imgContainer
.
addChild
(
img
);
return
imgContainer
}
private
createBox
(
width
:
number
,
height
:
number
):
engine
.
Shape
{
var
shape
=
new
engine
.
Shape
();
shape
.
beginFill
(
0xfff000
);
...
...
@@ -29,6 +43,17 @@ export default class GameView extends engine.Container {
}
onClick
(
e
:
engine
.
MouseEvent
)
{
// const ball = this.createBitmapByName('ball');
// this.addChild(ball);
// engine.Tween.get(ball, { loop: true }).to({ rotation: 360 }, 1000);
// return;
// const box = this.createBitmapByName('block');
// this.addChild(box);
// engine.Tween.get(box, { loop: true }).to({ rotation: 360 }, 1000);
// return;
// const box = this.createBox(750, 100)
// this.addChild(box);
// box.x = 750/2;
...
...
@@ -48,7 +73,7 @@ export default class GameView extends engine.Container {
if
(
Math
.
random
()
>
.
5
)
{
//添加方形刚体
var
boxShape
:
p2
.
Shape
=
new
p2
.
Box
({
width
:
200
/
factor
,
height
:
100
/
factor
});
var
boxShape
:
p2
.
Shape
=
new
p2
.
Box
({
width
:
306
/
factor
,
height
:
172
/
factor
});
var
boxBody
:
p2
.
Body
=
new
p2
.
Body
({
mass
:
1
,
position
:
[
positionX
,
positionY
],
angularVelocity
:
1
});
boxBody
.
addShape
(
boxShape
);
world
.
addBody
(
boxBody
);
...
...
@@ -56,14 +81,12 @@ export default class GameView extends engine.Container {
if
(
this
.
isDebug
)
{
display
=
this
.
createBox
((
<
p2
.
Box
>
boxShape
).
width
*
factor
,
(
<
p2
.
Box
>
boxShape
).
height
*
factor
);
}
else
{
// display = self.createBitmapByName("rect");
// display.width = (<p2.Box>boxShape).width * factor;
// display.height = (<p2.Box>boxShape).height * factor;
display
=
this
.
createBitmapByName
(
"block"
);
}
}
else
{
//添加圆形刚体
var
boxShape
:
p2
.
Shape
=
new
p2
.
Circle
({
radius
:
20
0
/
2
/
factor
});
var
boxShape
:
p2
.
Shape
=
new
p2
.
Circle
({
radius
:
12
0
/
2
/
factor
});
var
boxBody
:
p2
.
Body
=
new
p2
.
Body
({
mass
:
1
,
position
:
[
positionX
,
positionY
]
});
boxBody
.
addShape
(
boxShape
);
world
.
addBody
(
boxBody
);
...
...
@@ -71,7 +94,7 @@ export default class GameView extends engine.Container {
if
(
this
.
isDebug
)
{
display
=
this
.
createBall
((
<
p2
.
Circle
>
boxShape
).
radius
*
factor
);
}
else
{
// display = self.createBitmapByName("circle
");
display
=
this
.
createBitmapByName
(
"ball
"
);
}
// display.width = (<p2.Circle>boxShape).radius * 2 * factor;
...
...
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