Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
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
abdullh.alsoleman
Front-End
Commits
4e787993
Commit
4e787993
authored
Oct 12, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates sprite physics test
parent
5f907780
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
test_physics.dart
examples/game/test_physics.dart
+6
-2
No files found.
examples/game/test_physics.dart
View file @
4e787993
...
@@ -78,29 +78,33 @@ class TestBed extends NodeWithSize {
...
@@ -78,29 +78,33 @@ class TestBed extends NodeWithSize {
Sprite
shipA
;
Sprite
shipA
;
shipA
=
new
Sprite
(
_spriteSheet
[
"ship.png"
]);
shipA
=
new
Sprite
(
_spriteSheet
[
"ship.png"
]);
shipA
.
opacity
=
0.3
;
shipA
.
position
=
new
Point
(
pos
.
x
-
40.0
,
pos
.
y
);
shipA
.
position
=
new
Point
(
pos
.
x
-
40.0
,
pos
.
y
);
shipA
.
size
=
new
Size
(
64.0
,
64.0
);
shipA
.
size
=
new
Size
(
64.0
,
64.0
);
shipA
.
physicsBody
=
new
PhysicsBody
(
new
PhysicsShapeCircle
(
Point
.
origin
,
32.0
),
shipA
.
physicsBody
=
new
PhysicsBody
(
new
PhysicsShapeCircle
(
Point
.
origin
,
32.0
),
friction:
0.5
,
friction:
0.5
,
restitution:
0.5
,
tag:
"ship"
tag:
"ship"
);
);
_physicsNode
.
addChild
(
shipA
);
_physicsNode
.
addChild
(
shipA
);
shipA
.
physicsBody
.
applyLinearImpulse
(
shipA
.
physicsBody
.
applyLinearImpulse
(
new
Offset
(
randomSignedDouble
()
*
5
.0
,
randomSignedDouble
()
*
5
.0
),
new
Offset
(
randomSignedDouble
()
*
5
000.0
,
randomSignedDouble
()
*
5000
.0
),
shipA
.
position
shipA
.
position
);
);
Sprite
shipB
;
Sprite
shipB
;
shipB
=
new
Sprite
(
_spriteSheet
[
"ship.png"
]);
shipB
=
new
Sprite
(
_spriteSheet
[
"ship.png"
]);
shipB
.
opacity
=
0.3
;
shipB
.
position
=
new
Point
(
pos
.
x
+
40.0
,
pos
.
y
);
shipB
.
position
=
new
Point
(
pos
.
x
+
40.0
,
pos
.
y
);
shipB
.
size
=
new
Size
(
64.0
,
64.0
);
shipB
.
size
=
new
Size
(
64.0
,
64.0
);
shipB
.
physicsBody
=
new
PhysicsBody
(
new
PhysicsShapePolygon
([
new
Point
(-
25.0
,
-
25.0
),
new
Point
(
25.0
,
-
25.0
),
new
Point
(
25.0
,
25.0
),
new
Point
(-
25.0
,
25.0
)]),
shipB
.
physicsBody
=
new
PhysicsBody
(
new
PhysicsShapePolygon
([
new
Point
(-
25.0
,
-
25.0
),
new
Point
(
25.0
,
-
25.0
),
new
Point
(
25.0
,
25.0
),
new
Point
(-
25.0
,
25.0
)]),
friction:
0.5
,
friction:
0.5
,
restitution:
0.5
,
tag:
"ship"
tag:
"ship"
);
);
_physicsNode
.
addChild
(
shipB
);
_physicsNode
.
addChild
(
shipB
);
new
PhysicsJoint
Weld
(
shipA
.
physicsBody
,
shipB
.
physicsBody
);
new
PhysicsJoint
Revolute
(
shipA
.
physicsBody
,
shipB
.
physicsBody
,
pos
);
}
}
return
true
;
return
true
;
}
}
...
...
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