Changeset 8895 for 2017/27/OskariK/OK/OK/OK/OK.cs
- Timestamp:
- 2017-07-04 14:59:43 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/27/OskariK/OK/OK/OK/OK.cs
r8863 r8895 16 16 PhysicsObject Pointer; 17 17 18 IntMeter goopHP; 19 IntMeter HP; 20 21 Label foeHP; 22 Label playerHP; 23 18 24 Vector nopeusYlos = new Vector(0, 100); 19 25 Vector nopeusAlas = new Vector(0, -100); … … 25 31 LuoAlue(); 26 32 luopelaaja(); 33 LuoHP(); 27 34 Kontrollit(); 35 28 36 29 37 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); … … 58 66 foe = new GameObject(1800.00, 700.00); 59 67 foe.Shape = Shape.Rectangle; 60 foe.Color = Color. Blue;68 foe.Color = Color.Aqua; 61 69 foe.X = -10.00; 62 70 foe.Y = 200.00; 71 foe.Image = LoadImage("köntsä"); 63 72 Add(foe); 64 73 } … … 66 75 PhysicsObject luopelaaja() 67 76 { 68 Pointer = new PhysicsObject (10.0, 10.0);77 Pointer = new PhysicsObject(5.0, 5.0); 69 78 Pointer.Color = Color.White; 70 79 Pointer.X = 190.00; 71 80 Pointer.Y = -220.00; 72 Add(Pointer, 3);81 Add(Pointer, 3); 73 82 return Pointer; 74 }83 } 75 84 85 void LuoHP() 86 { 87 goopHP = new IntMeter(20); 88 89 Label foeHP = new Label(); 90 91 foeHP.X = 0.00; 92 foeHP.Y = Screen.Top - 40.00; 93 foeHP.TextColor = Color.Red; 94 foeHP.Color = Color.Transparent; 95 96 foeHP.BindTo(goopHP); 97 Add(foeHP); 98 99 HP = new IntMeter(60); 100 101 Label playerHP = new Label(); 102 103 playerHP.X = 660.00; 104 playerHP.Y = -200.00; 105 playerHP.TextColor = Color.LightGreen; 106 playerHP.Color = Color.Transparent; 107 108 playerHP.BindTo(HP); 109 Add(playerHP); 110 111 112 113 114 } 76 115 void AsetaNopeus(PhysicsObject Pointer, Vector nopeus) 77 116 { 117 if (Pointer.Velocity.Magnitude > 0) return; 118 78 119 Vector sijainti = Pointer.Position + nopeus; 79 120 if (sijainti.Y > command.Top) return; … … 81 122 82 123 Pointer.MoveTo(Pointer.Position + nopeus, 1000.00); 83 124 84 125 } 85 void Kontrollit 126 void Kontrollit() 86 127 { 87 128 Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); … … 97 138 //Keyboard.Listen(Key.Right, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 98 139 99 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); } 140 Keyboard.Listen(Key.Z, ButtonState.Pressed, Valitse, null); 141 142 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 143 144 } 145 146 void Valitse() 147 148 { 149 if (Pointer.Y > command.Top - command.Height / 3) Attack(); 150 else if (Pointer.Y < command.Bottom + command.Height / 3) Exit(); 151 else Exit(); 152 } 153 154 void Attack() 155 { 156 goopHP.Value -=10; 157 } 100 158 }
Note: See TracChangeset
for help on using the changeset viewer.