Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: sky/sdk/example/game/lib/action.dart

Issue 1223543004: Adds better explosions, shield, and game over (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 part of sprites; 1 part of sprites;
2 2
3 typedef void PointSetter(Point point); 3 typedef void ActionCallback();
4 4
5 abstract class Action { 5 abstract class Action {
6 bool _finished = false; 6 bool _finished = false;
7 7
8 void step(double dt); 8 void step(double dt);
9 void update(double t) { 9 void update(double t) {
10 } 10 }
11 11
12 double get duration => 0.0; 12 double get duration => 0.0;
13 } 13 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 void update(double t) { 117 void update(double t) {
118 fire(); 118 fire();
119 _finished = true; 119 _finished = true;
120 } 120 }
121 121
122 void fire(); 122 void fire();
123 } 123 }
124 124
125 class ActionCallFunction extends ActionInstant { 125 class ActionCallFunction extends ActionInstant {
126 Function _function; 126 ActionCallback _function;
127 127
128 ActionCallFunction(this._function); 128 ActionCallFunction(this._function);
129 129
130 void fire() { 130 void fire() {
131 _function(); 131 _function();
132 } 132 }
133 } 133 }
134 134
135 class ActionRemoveFromParent extends ActionInstant { 135 class ActionRemoveNode extends ActionInstant {
136 Node _node; 136 Node _node;
137 137
138 ActionRemoveFromParent(this._node); 138 ActionRemoveNode(this._node);
139 139
140 void fire() { 140 void fire() {
141 _node.removeFromParent(); 141 _node.removeFromParent();
142 } 142 }
143 } 143 }
144 144
145 class ActionRepeatForever extends Action { 145 class ActionRepeatForever extends Action {
146 final ActionInterval action; 146 final ActionInterval action;
147 double _elapsedInAction = 0.0; 147 double _elapsedInAction = 0.0;
148 148
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 for (int i = _actions.length - 1; i >= 0; i--) { 226 for (int i = _actions.length - 1; i >= 0; i--) {
227 Action action = _actions[i]; 227 Action action = _actions[i];
228 action.step(dt); 228 action.step(dt);
229 229
230 if (action._finished) { 230 if (action._finished) {
231 _actions.removeAt(i); 231 _actions.removeAt(i);
232 } 232 }
233 } 233 }
234 } 234 }
235 } 235 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/example/game/lib/game_demo.dart » ('j') | sky/sdk/example/game/lib/game_demo.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698