Changeset 8634 for 2017/24/AaroM/Asteroids/Asteroids/Asteroids/Asteroids.cs
- Timestamp:
- 2017-06-14 11:29:32 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/24/AaroM/Asteroids/Asteroids/Asteroids/Asteroids.cs
r8623 r8634 9 9 public class Asteroids : PhysicsGame 10 10 { 11 PhysicsObject spaceship2; 12 PhysicsObject spaceship1; 11 13 public override void Begin() 12 {14 { 13 15 14 16 asteroidi(0.0, 0.0); 15 spaceship1(); 16 spaceship2(); 17 18 17 Spaceship1(); 18 Spaceship2(); 19 Liikkumiskomennot(); 19 20 20 21 21 22 22 23 Level.CreateBorders(1.0, false); 24 25 26 27 23 28 24 29 Level.Background.Image = LoadImage("space loollololl"); 25 30 26 27 31 28 29 32 33 34 30 35 // TODO: Kirjoita ohjelmakoodisi tähän 31 36 … … 35 40 36 41 void asteroidi(double X, double Y) 37 {PhysicsObject asteroidi = new PhysicsObject(260.0, 200.0); 42 { 43 PhysicsObject asteroidi = new PhysicsObject(260.0, 200.0); 38 44 asteroidi.Image = LoadImage("joo"); 39 45 asteroidi.X = 270; … … 42 48 } 43 49 44 void spaceship1() 45 { PhysicsObject spaceship = new PhysicsObject(50.0, 50.0); 46 spaceship.Image = LoadImage("#spaceship"); 47 Add (spaceship); 50 void Spaceship1() 51 { 52 spaceship1 = new PhysicsObject(50.0, 50.0); 53 spaceship1.Image = LoadImage("#spaceship"); 54 Add(spaceship1); 48 55 } 49 56 50 void spaceship2() 51 { PhysicsObject spaceship2 = new PhysicsObject(50.0, 50.0); 57 void Spaceship2() 58 { 59 spaceship2 = new PhysicsObject(50.0, 50.0); 52 60 spaceship2.X = 100; 53 61 spaceship2.Y = 0; … … 55 63 Add(spaceship2); 56 64 } 65 void Liikkumiskomennot() 66 { 67 Keyboard.Listen(Key.Left, ButtonState.Down, Liikutaspaceship2, null, new Vector(-100, 0)); 68 Keyboard.Listen(Key.Right, ButtonState.Down, Liikutaspaceship2, null, new Vector(100, 0)); 69 Keyboard.Listen(Key.Up, ButtonState.Down, Liikutaspaceship2, null, new Vector(0, 100)); 70 Keyboard.Listen(Key.Down, ButtonState.Down, Liikutaspaceship2, null, new Vector(0, -100)); 71 72 Keyboard.Listen(Key.A, ButtonState.Down, Liikutaspaceship1, null, new Vector(-100, 0)); 73 Keyboard.Listen(Key.D, ButtonState.Down, Liikutaspaceship1, null, new Vector(100, 0)); 74 Keyboard.Listen(Key.W, ButtonState.Down, Liikutaspaceship1, null, new Vector(0, 100)); 75 Keyboard.Listen(Key.S, ButtonState.Down, Liikutaspaceship1, null, new Vector(0, -100)); 76 } 77 void Liikutaspaceship2(Vector vektori) 78 { 79 spaceship2.Push(vektori); 80 81 } 82 void Liikutaspaceship1(Vector vektori) 83 { 84 spaceship1.Push(vektori); 85 } 57 86 58 87
Note: See TracChangeset
for help on using the changeset viewer.