Changeset 6175
- Timestamp:
- 2015-06-23 13:35:07 (8 years ago)
- Location:
- 2015/26/RonjaT/Pong
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/26/RonjaT/Pong/Pong/Pong/Pong.cs
r6166 r6175 17 17 PhysicsObject maila2; 18 18 19 PhysicsObject vasenReuna; 20 PhysicsObject oikeaReuna; 21 19 22 IntMeter pelaajan1pisteet; 20 23 IntMeter pelaajan2pisteet; … … 24 27 LuoKentta(); 25 28 AsetaOhjaimet(); 26 27 29 LisaaLaskurit(); 28 30 AloitaPeli(); … … 32 34 { 33 35 pallo = new PhysicsObject(40.0, 40.0); 34 35 36 pallo.Shape = Shape.Circle; 36 37 pallo.X = -200.0; … … 38 39 pallo.Restitution = 1.0; 39 40 Add(pallo); 41 AddCollisionHandler(pallo, KasittelePallonTormays); 42 43 44 45 maila1 = LuoMaila(Level.Left + 20.0, 0.0); 46 maila2 = LuoMaila(Level.Right - 20.0, 0.0); 47 48 49 vasenReuna = Level.CreateLeftBorder(); 50 vasenReuna.Restitution = 1.0; 51 vasenReuna.IsVisible = false; 52 53 oikeaReuna = Level.CreateRightBorder(); 54 oikeaReuna.Restitution = 1.0; 55 oikeaReuna.IsVisible = false; 56 57 PhysicsObject alaReuna = Level.CreateBottomBorder(); 58 alaReuna.Restitution = 1.0; 59 alaReuna.IsVisible = false; 60 alaReuna.KineticFriction = 0.0; 61 62 PhysicsObject yläReuna = Level.CreateTopBorder(); 63 yläReuna.Restitution = 1.0; 64 yläReuna.IsVisible = false; 65 66 67 Level.Background.Color = Color.Black; 68 Camera.ZoomToLevel(); 69 } 40 70 41 71 void KasittelePallonTormays(PhysicsObject pallo, PhysicsObject kohde) 42 72 { 73 if (kohde == oikeaReuna) 74 { 75 pelaajan1pisteet.Value += 1; 76 } 77 else if (kohde == vasenReuna) 78 { 79 pelaajan2pisteet.Value += 1; 80 } 43 81 } 44 45 maila1 = LuoMaila(Level.Left + 20.0, 0.0);46 maila2 = LuoMaila(Level.Right - 20.0, 0.0);47 48 49 PhysicsObject vasenReuna = Level.CreateLeftBorder();50 vasenReuna.Restution = 1.0;51 vasenReuna.IsVisible = flase;52 53 PhysicsObject54 55 Level.Background.Color = Color.Black;56 Camera.ZoomToLevel();57 }58 59 82 void AloitaPeli() 60 83 {
Note: See TracChangeset
for help on using the changeset viewer.