- Timestamp:
- 2016-06-28 11:30:23 (7 years ago)
- Location:
- 2016/26/PinjaT/Pong
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/26/PinjaT/Pong/Pong/Pong/Pong.cs
r7532 r7547 16 16 PhysicsObject maila2; 17 17 18 PhysicsObject vasenReuna; 19 PhysicsObject oikeaReuna; 20 18 21 IntMeter pelaajan1Pisteet; 19 22 IntMeter pelaajan2Pisteet; 23 20 24 21 25 public override void Begin() … … 41 45 maila2 = LuoMaila(Level.Right - 20.0, 0.0); 42 46 43 PhysicsObjectvasenReuna = Level.CreateLeftBorder();47 vasenReuna = Level.CreateLeftBorder(); 44 48 vasenReuna.Restitution = 1.0; 45 49 vasenReuna.IsVisible = false; 46 50 47 PhysicsObjectoikeaReuna = Level.CreateRightBorder();51 oikeaReuna = Level.CreateRightBorder(); 48 52 oikeaReuna.Restitution = 1.0; 49 53 oikeaReuna.IsVisible = false; 50 54 51 PhysicsObject ala reuna = Level.CreateBottomBorder();55 PhysicsObject alaReuna = Level.CreateBottomBorder(); 52 56 alaReuna.Restitution = 1.0; 53 alareuna.IsVisible = false; 57 alaReuna.IsVisible = false; 58 59 PhysicsObject yläReuna = Level.CreateTopBorder(); 60 yläReuna.Restitution = 1.0; 61 yläReuna.IsVisible = false; 54 62 55 63 oikeaReuna.Restitution = 1.0; … … 77 85 Vector impulssi = new Vector(500.0, 200.0); 78 86 pallo.Hit(impulssi); 87 } 88 89 const double PALLON_MIN_NOPEUS = 500; 90 91 protected override void Update(Time time) 92 { 93 if (pallo != null && Math.Abs(pallo.Velocity.X) < PALLON_MIN_NOPEUS) 94 { 95 pallo.Velocity = new Vector(pallo.Velocity.X * 1.1, pallo.Velocity.Y); 96 } 97 base.Update(time); 79 98 } 80 99 … … 148 167 void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 149 168 { 169 if (kohde == oikeaReuna) 170 { 171 pelaajan1Pisteet.Value += 1; 172 } 173 else if (kohde == vasenReuna) 174 { 175 pelaajan2Pisteet.Value += 1; 176 } 150 177 151 178 }
Note: See TracChangeset
for help on using the changeset viewer.