Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
playground
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
playground
Commits
c7e435f0
Commit
c7e435f0
authored
Apr 06, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
f9df87f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
11 deletions
+2
-11
main.js
test/src/game/main.js
+1
-10
meta.json
test/src/meta.json
+1
-1
No files found.
test/src/game/main.js
View file @
c7e435f0
...
@@ -50,7 +50,7 @@ class GameStage extends WidgetBase {
...
@@ -50,7 +50,7 @@ class GameStage extends WidgetBase {
const
ball
=
new
Body
({
const
ball
=
new
Body
({
display
:
'box'
,
display
:
'box'
,
initialVelocityY
:
0
,
initialVelocityY
:
0
,
initialVelocityX
:
1
,
initialVelocityX
:
2
,
accelerationY
:
2
,
accelerationY
:
2
,
restitution
:
0
restitution
:
0
});
});
...
@@ -73,18 +73,9 @@ class GameStage extends WidgetBase {
...
@@ -73,18 +73,9 @@ class GameStage extends WidgetBase {
const
dis0
=
body
.
width
/
2
+
ground
.
data
.
width
/
2
;
const
dis0
=
body
.
width
/
2
+
ground
.
data
.
width
/
2
;
const
dis1
=
Math
.
abs
(
body
.
x
+
body
.
width
/
2
-
ground
.
data
.
x
-
ground
.
data
.
width
/
2
);
const
dis1
=
Math
.
abs
(
body
.
x
+
body
.
width
/
2
-
ground
.
data
.
x
-
ground
.
data
.
width
/
2
);
if
(
y0
>
ground
.
y
&&
dis1
<
dis0
)
{
if
(
y0
>
ground
.
y
&&
dis1
<
dis0
)
{
// if (!body.checkCollideGround) {
// body.checkCollideGround = ground;
// console.log('碰撞了地面', JSON.stringify(ground.data));
// }
body
.
y
=
ground
.
y
-
body
.
height
;
body
.
y
=
ground
.
y
-
body
.
height
;
body
.
velocityY
=
-
body
.
velocityY
*
body
.
restitution
;
body
.
velocityY
=
-
body
.
velocityY
*
body
.
restitution
;
break
;
break
;
}
else
{
// if (body.checkCollideGround) {
// console.log('取消碰撞地面', JSON.stringify(ground.data));
// }
// body.checkCollideGround = null;
}
}
}
}
}
}
...
...
test/src/meta.json
View file @
c7e435f0
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
},
},
{
{
"name"
:
"box"
,
"name"
:
"box"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
2ded44a3459c08e000d08b60dd6248d283fe2c80
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
45acae15337682c4a2c1c694a3b0a54509cc0b14
.png"
,
"uuid"
:
"box"
,
"uuid"
:
"box"
,
"ext"
:
".png"
"ext"
:
".png"
},
},
...
...
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