Changeset 8863 for 2017/27/OskariK/OK/OK/OK/OK.cs
- Timestamp:
- 2017-07-04 11:54:53 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/27/OskariK/OK/OK/OK/OK.cs
r8840 r8863 7 7 using Jypeli.Widgets; 8 8 9 public class OK : Game9 public class OK : PhysicsGame 10 10 { 11 PhysicsObject command; 12 PhysicsObject feed; 11 GameObject command; 12 GameObject feed; 13 GameObject portrait; 14 GameObject foe; 15 16 PhysicsObject Pointer; 17 18 Vector nopeusYlos = new Vector(0, 100); 19 Vector nopeusAlas = new Vector(0, -100); 20 Vector nopeusVasen = new Vector(-200, 0); 21 Vector nopeusOikea = new Vector(200, 0); 22 13 23 public override void Begin() 14 24 { 15 25 LuoAlue(); 26 luopelaaja(); 16 27 Kontrollit(); 17 28 … … 23 34 Level.Background.Color = Color.White; 24 35 25 command = new PhysicsObject(400.0, 300.0);36 command = new GameObject(450.0, 300.0); 26 37 command.Shape = Shape.Rectangle; 27 38 command.Color = Color.Black; 28 command.X = 100.00; 29 command.Y = -250.00; 39 command.X = 370.00; 40 command.Y = -330.00; 41 command.Image = LoadImage("Kökkö"); 30 42 Add(command); 31 43 32 feed = new PhysicsObject(700.00, 300.00);44 feed = new GameObject(1000.00, 300.00); 33 45 feed.Shape = Shape.Rectangle; 34 46 feed.Color = Color.Black; 35 feed.X = - 500.00;36 feed.Y = - 250.00;47 feed.X = -400.00; 48 feed.Y = -330.00; 37 49 Add(feed); 38 50 39 portrait = new PhysicsObject(100.00, 300.00); 51 portrait = new GameObject(250.00, 300.00); 52 portrait.Shape = Shape.Rectangle; 53 portrait.Color = Color.Black; 54 portrait.X = 750.00; 55 portrait.Y = -330.00; 56 Add(portrait); 57 58 foe = new GameObject(1800.00, 700.00); 59 foe.Shape = Shape.Rectangle; 60 foe.Color = Color.Blue; 61 foe.X = -10.00; 62 foe.Y = 200.00; 63 Add(foe); 40 64 } 41 65 66 PhysicsObject luopelaaja() 67 { 68 Pointer = new PhysicsObject (10.0, 10.0); 69 Pointer.Color = Color.White; 70 Pointer.X = 190.00; 71 Pointer.Y = -220.00; 72 Add(Pointer,3); 73 return Pointer; 74 } 75 76 void AsetaNopeus(PhysicsObject Pointer, Vector nopeus) 77 { 78 Vector sijainti = Pointer.Position + nopeus; 79 if (sijainti.Y > command.Top) return; 80 else if (sijainti.Y < command.Bottom) return; 81 82 Pointer.MoveTo(Pointer.Position + nopeus, 1000.00); 83 84 } 42 85 void Kontrollit () 43 { Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); } 86 { 87 Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); 88 //Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 89 90 Keyboard.Listen(Key.Up, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusYlos); 91 //Keyboard.Listen(Key.Up, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 92 93 //Keyboard.Listen(Key.Left, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusVasen); 94 ///Keyboard.Listen(Key.Left, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 95 96 //Keyboard.Listen(Key.Right, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusOikea); 97 //Keyboard.Listen(Key.Right, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 98 99 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); } 44 100 }
Note: See TracChangeset
for help on using the changeset viewer.