| OLD | NEW |
| 1 part of game; | 1 part of game; |
| 2 | 2 |
| 3 const double _steeringThreshold = 0.0; |
| 4 const double _steeringMax = 150.0; |
| 5 |
| 3 // Random generator | 6 // Random generator |
| 4 Math.Random _rand = new Math.Random(); | 7 Math.Random _rand = new Math.Random(); |
| 5 | 8 |
| 6 const double _gameSizeWidth = 1024.0; | 9 const double _gameSizeWidth = 1024.0; |
| 7 const double _gameSizeHeight = 1024.0; | 10 const double _gameSizeHeight = 1024.0; |
| 8 | 11 |
| 9 const double _shipRadius = 30.0; | 12 const double _shipRadius = 30.0; |
| 10 const double _lrgAsteroidRadius = 40.0; | 13 const double _lrgAsteroidRadius = 40.0; |
| 11 const double _medAsteroidRadius = 20.0; | 14 const double _medAsteroidRadius = 20.0; |
| 12 const double _smlAsteroidRadius = 10.0; | 15 const double _smlAsteroidRadius = 10.0; |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 Laser.withImage(Image img, Ship ship) : super.withImage(img) { | 353 Laser.withImage(Image img, Ship ship) : super.withImage(img) { |
| 351 size = new Size(20.0, 20.0); | 354 size = new Size(20.0, 20.0); |
| 352 position = ship.position; | 355 position = ship.position; |
| 353 rotation = ship.rotation + 90.0; | 356 rotation = ship.rotation + 90.0; |
| 354 transferMode = TransferMode.plus; | 357 transferMode = TransferMode.plus; |
| 355 double rotRadians = convertDegrees2Radians(rotation); | 358 double rotRadians = convertDegrees2Radians(rotation); |
| 356 _movementVector = pointMult(new Point(Math.sin(rotRadians), -Math.cos(rotRad
ians)), 10.0); | 359 _movementVector = pointMult(new Point(Math.sin(rotRadians), -Math.cos(rotRad
ians)), 10.0); |
| 357 _movementVector = new Point(_movementVector.x + ship._movementVector[0], _mo
vementVector.y + ship._movementVector[1]); | 360 _movementVector = new Point(_movementVector.x + ship._movementVector[0], _mo
vementVector.y + ship._movementVector[1]); |
| 358 } | 361 } |
| 359 | 362 |
| 360 bool move() { | 363 void move() { |
| 361 position = pointAdd(position, _movementVector); | 364 position = pointAdd(position, _movementVector); |
| 362 _frameCount++; | 365 _frameCount++; |
| 363 } | 366 } |
| 364 } | 367 } |
| 365 | 368 |
| 366 // Background starfield | 369 // Background starfield |
| 367 | 370 |
| 368 class StarField extends Node { | 371 class StarField extends Node { |
| 369 Image _img; | 372 Image _img; |
| 370 int _numStars; | 373 int _numStars; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 double dy = a.y - b.y; | 469 double dy = a.y - b.y; |
| 467 if (dx < 0.0) dx = -dx; | 470 if (dx < 0.0) dx = -dx; |
| 468 if (dy < 0.0) dy = -dy; | 471 if (dy < 0.0) dy = -dy; |
| 469 if (dx > dy) { | 472 if (dx > dy) { |
| 470 return dx + dy/2.0; | 473 return dx + dy/2.0; |
| 471 } | 474 } |
| 472 else { | 475 else { |
| 473 return dy + dx/2.0; | 476 return dy + dx/2.0; |
| 474 } | 477 } |
| 475 } | 478 } |
| OLD | NEW |