- Timestamp:
- 2016-06-28 10:57:18 (7 years ago)
- Location:
- 2016/26/JonniN/Pong8)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/26/JonniN/Pong8)/Pong8)/Pong8_/Pong8_.cs
r7529 r7540 13 13 14 14 PhysicsObject pallo; 15 15 IntMeter laskuri; 16 16 PhysicsObject maila1; 17 17 PhysicsObject maila2; … … 58 58 59 59 pallo.Restitution = 1.0; 60 Level.Background.Color = Color. Black;60 Level.Background.Color = Color.DarkAzure; 61 61 pallo.Color = Color.Yellow; 62 62 … … 130 130 pelaajan1Pisteet = LuoPisteLaskuri(Screen.Left + 100.0, Screen.Top - 100.0); 131 131 pelaajan2Pisteet = LuoPisteLaskuri(Screen.Right - 100.0, Screen.Top - 100.0); 132 pelaajan1Pisteet.UpperLimit += NollaaLaskuri; 133 pelaajan2Pisteet.UpperLimit += NollaaLaskuri; 132 134 133 135 } … … 142 144 pelaajan2Pisteet.Value += 1; 143 145 } 146 147 } 148 const double PALLON_MIN_NOPEUS = 500; 149 150 protected override void Update(Time time) 151 { 152 if(pallo !=null && Math.Abs(pallo.Velocity.X) < PALLON_MIN_NOPEUS) 153 { 154 pallo.Velocity = new Vector(pallo.Velocity.X * 1.1, pallo.Velocity.Y); 155 } 156 base.Update(time); 157 } 158 void NollaaLaskuri() 159 { 160 pelaajan1Pisteet.Value = 0; 161 pelaajan2Pisteet.Value = 0; 162 } 163 void VoittoViesti1(int voittaja) 164 { 165 if (voittaja == 1) 166 { 167 MessageDisplay.Add("Pelaaja 1 voitti!"); 168 } 169 else 170 { 171 MessageDisplay.Add("Pelaaja 2 voitti!"); 172 } 173 144 174 } 145 175 }
Note: See TracChangeset
for help on using the changeset viewer.