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
f48b88cd
Commit
f48b88cd
authored
Oct 16, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates physics test
parent
909c98fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
test_physics.dart
examples/game/test_physics.dart
+9
-1
No files found.
examples/game/test_physics.dart
View file @
f48b88cd
import
'dart:ui'
;
import
'package:flutter/animation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
...
...
@@ -52,7 +53,7 @@ class TestBed extends NodeWithSize {
_physicsNode
=
new
PhysicsNode
(
new
Offset
(
0.0
,
100.0
));
_obstacle
=
new
Sprite
(
_spriteSheet
[
"ship.png"
]);
_obstacle
.
position
=
new
Point
(
5
3
2.0
,
800.0
);
_obstacle
.
position
=
new
Point
(
5
1
2.0
,
800.0
);
_obstacle
.
size
=
new
Size
(
64.0
,
64.0
);
_obstacle
.
physicsBody
=
new
PhysicsBody
(
new
PhysicsShapeCircle
(
Point
.
origin
,
32.0
),
...
...
@@ -63,6 +64,13 @@ class TestBed extends NodeWithSize {
_physicsNode
.
addChild
(
_obstacle
);
_physicsNode
.
addContactCallback
(
myCallback
,
"obstacle"
,
"ship"
,
PhysicsContactType
.
begin
);
// Animate obstacle
ActionSequence
seq
=
new
ActionSequence
([
new
ActionTween
((
a
)
=>
_obstacle
.
position
=
a
,
new
Point
(
256.0
,
800.0
),
new
Point
(
768.0
,
800.0
),
1.0
,
easeInOut
),
new
ActionTween
((
a
)
=>
_obstacle
.
position
=
a
,
new
Point
(
768.0
,
800.0
),
new
Point
(
256.0
,
800.0
),
1.0
,
easeInOut
)
]);
_obstacle
.
actions
.
run
(
new
ActionRepeatForever
(
seq
));
addChild
(
_physicsNode
);
userInteractionEnabled
=
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