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
fbb645bb
Commit
fbb645bb
authored
Jul 29, 2015
by
Viktor Lidholt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes compilation error in demo game and adds auto scrolling star field
parent
8b4d0201
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
game_demo_world.dart
packages/flutter/example/game/lib/game_demo_world.dart
+10
-3
No files found.
packages/flutter/example/game/lib/game_demo_world.dart
View file @
fbb645bb
...
...
@@ -561,9 +561,10 @@ class Laser extends Sprite {
// Background starfield
class
StarField
extends
Node
{
Image
_image
;
class
StarField
extends
Node
WithSize
{
sky
.
Image
_image
;
int
_numStars
;
bool
_autoScroll
;
List
<
Point
>
_starPositions
;
List
<
double
>
_starScales
;
List
<
Rect
>
_rects
;
...
...
@@ -573,7 +574,7 @@ class StarField extends Node {
..
isAntiAlias
=
false
..
setTransferMode
(
sky
.
TransferMode
.
plus
);
StarField
(
SpriteSheet
spriteSheet
,
this
.
_numStars
)
{
StarField
(
SpriteSheet
spriteSheet
,
this
.
_numStars
,
[
this
.
_autoScroll
=
false
])
:
super
(
new
Size
(
1024.0
,
1024.0
)
)
{
_starPositions
=
[];
_starScales
=
[];
_colors
=
[];
...
...
@@ -618,6 +619,12 @@ class StarField extends Node {
_starPositions
[
i
]
=
new
Point
(
xPos
,
yPos
);
}
}
void
update
(
double
dt
)
{
if
(
_autoScroll
)
{
move
(
dt
*
100.0
,
0.0
);
}
}
}
class
Hud
extends
NodeWithSize
{
...
...
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