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
a07cb95e
Commit
a07cb95e
authored
Oct 06, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1506 from vlidholt/master
Fixes to demo game
parents
ee0c01c5
018cef61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
11 deletions
+69
-11
main.dart
examples/game/lib/main.dart
+4
-2
physics_body.dart
packages/flutter_sprites/lib/physics_body.dart
+65
-9
No files found.
examples/game/lib/main.dart
View file @
a07cb95e
...
...
@@ -119,8 +119,10 @@ class GameDemoState extends State<GameDemo> {
width:
128.0
,
height:
128.0
),
new
Text
(
"Last Score:
$_lastScore
"
,
new
DefaultTextStyle
(
child:
new
Text
(
"Last Score:
$_lastScore
"
),
style:
new
TextStyle
(
fontSize:
20.0
)
)
],
...
...
packages/flutter_sprites/lib/physics_body.dart
View file @
a07cb95e
...
...
@@ -9,10 +9,10 @@ class PhysicsBody {
PhysicsBody
(
this
.
shape
,
{
this
.
tag
:
null
,
this
.
type
:
PhysicsBodyType
.
dynamic
,
this
.
density
:
1.0
,
this
.
friction
:
0.0
,
this
.
restitution
:
0.0
,
this
.
isSensor
:
false
,
double
density:
1.0
,
double
friction:
0.0
,
double
restitution:
0.0
,
bool
isSensor:
false
,
this
.
linearVelocity
:
Offset
.
zero
,
this
.
angularVelocity
:
0.0
,
this
.
linearDampening
:
0.0
,
...
...
@@ -23,7 +23,12 @@ class PhysicsBody {
this
.
bullet
:
false
,
this
.
active
:
true
,
this
.
gravityScale
:
1.0
});
})
{
this
.
density
=
density
;
this
.
friction
=
friction
;
this
.
restitution
=
restitution
;
this
.
isSensor
=
isSensor
;
}
Object
tag
;
...
...
@@ -31,10 +36,61 @@ class PhysicsBody {
PhysicsBodyType
type
;
double
density
;
double
friction
;
double
restitution
;
bool
isSensor
;
double
_density
;
double
get
density
=>
_density
;
set
density
(
double
density
)
{
_density
=
density
;
if
(
_body
==
null
)
return
;
for
(
box2d
.
Fixture
f
=
_body
.
getFixtureList
();
f
!=
null
;
f
=
f
.
getNext
())
{
f
.
setDensity
(
density
);
}
}
double
_friction
;
double
get
friction
=>
_friction
;
set
friction
(
double
friction
)
{
_friction
=
friction
;
if
(
_body
==
null
)
return
;
for
(
box2d
.
Fixture
f
=
_body
.
getFixtureList
();
f
!=
null
;
f
=
f
.
getNext
())
{
f
.
setFriction
(
friction
);
}
}
double
_restitution
;
double
get
restitution
=>
_restitution
;
set
restitution
(
double
restitution
)
{
_restitution
=
restitution
;
if
(
_body
==
null
)
return
;
for
(
box2d
.
Fixture
f
=
_body
.
getFixtureList
();
f
!=
null
;
f
=
f
.
getNext
())
{
f
.
setRestitution
(
restitution
);
}
}
bool
_isSensor
;
bool
get
isSensor
=>
_isSensor
;
set
isSensor
(
bool
isSensor
)
{
_isSensor
=
isSensor
;
if
(
_body
==
null
)
return
;
for
(
box2d
.
Fixture
f
=
_body
.
getFixtureList
();
f
!=
null
;
f
=
f
.
getNext
())
{
f
.
setSensor
(
isSensor
);
}
}
Offset
linearVelocity
;
double
angularVelocity
;
...
...
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