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
f56db825
Commit
f56db825
authored
Apr 06, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
48ed6490
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
main.js
test/src/game/main.js
+13
-6
meta.json
test/src/meta.json
+1
-1
No files found.
test/src/game/main.js
View file @
f56db825
...
...
@@ -24,9 +24,13 @@ class GameStage extends WidgetBase {
const
ground
=
new
Ground
({
data
:
groundData
,
display
:
createGroundDisplay
(
groundData
)
})
this
.
addGround
(
ground
);
setTimeout
(()
=>
{
this
.
removeGround
(
ground
)
},
3000
);
const
groundData1
=
{
x
:
400
,
y
:
this
.
stage
.
viewRect
.
height
/
3
*
2
,
width
:
200
,
height
:
10
};
const
ground1
=
new
Ground
({
data
:
groundData1
,
display
:
createGroundDisplay
(
groundData1
)
})
this
.
addGround
(
ground1
);
// setTimeout(() => {
// this.removeGround(ground)
// }, 3000);
}
grounds
;
...
...
@@ -44,8 +48,9 @@ class GameStage extends WidgetBase {
}
addbodys
()
{
const
ball
=
new
Body
({
display
:
'b
all
'
,
display
:
'b
ox
'
,
initialVelocityY
:
0
,
initialVelocityX
:
2
,
accelerationY
:
2
,
restitution
:
0
});
...
...
@@ -57,7 +62,7 @@ class GameStage extends WidgetBase {
restitution
:
0
});
block
.
x
=
30
0
;
block
.
x
=
62
0
;
this
.
addChild
(
block
);
this
.
bodys
.
push
(
block
);
...
...
@@ -78,7 +83,9 @@ class GameStage extends WidgetBase {
for
(
let
i
=
0
;
i
<
this
.
grounds
.
length
;
i
++
)
{
const
ground
=
this
.
grounds
[
i
];
// console.log(y0, ground.y)
if
(
y0
>
ground
.
y
)
{
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
);
if
(
y0
>
ground
.
y
&&
dis1
<
dis0
)
{
body
.
y
=
ground
.
y
-
body
.
height
;
body
.
velocityY
=
-
body
.
velocityY
*
body
.
restitution
;
break
;
...
...
test/src/meta.json
View file @
f56db825
...
...
@@ -29,7 +29,7 @@
},
{
"name"
:
"box"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
6fb4612326d4e78b715a83d1114fa2d96fb8adcb
.png"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/
2ded44a3459c08e000d08b60dd6248d283fe2c80
.png"
,
"uuid"
:
"box"
,
"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