Changeset 7782
- Timestamp:
- 2016-07-05 14:28:36 (7 years ago)
- Location:
- 2016/27/OnniK/Pong
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/27/OnniK/Pong/Pong/Pong/Pong.cs
r7758 r7782 16 16 PhysicsObject maila1; 17 17 PhysicsObject maila2; 18 19 IntMeter pelaajan1Pisteet; 20 IntMeter pelaajan2Pisteet; 18 21 public override void Begin() 19 22 { … … 51 54 return maila; 52 55 } 56 void KasittelePallonTormaus(PhysicsObject pallo, PhysicsObject kohde) 57 { 58 if (kohde == oikeaReuna) 59 60 61 pelaajan1Pisteet.Value += 1; 62 63 53 64 void LuoKentta() 54 65 { … … 65 76 66 77 67 Level.CreateBorders(1.0, false); 78 PhysicsObject vasenReuna = Level.CreateLeftBorder(); 79 vasenReuna.Restitution = 1.0; 80 vasenReuna.IsVisible = false; 81 82 PhysicsObject oikeaReuna = Level.CreateRightBorder(); 83 oikeaReuna.Restitution = 1.0; 84 oikeaReuna.IsVisible = false; 85 86 PhysicsObject alaReuna = Level.CreateBottomBorder(); 87 alaReuna.Restitution = 1.0; 88 alaReuna.IsVisible = false; 89 90 PhysicsObject yläReuna = Level.CreateTopBorder(); 91 yläReuna.Restitution = 1.0; 92 yläReuna.IsVisible = false; 93 68 94 Level.Background.Color = Color.Black; 69 95 70 96 Camera.ZoomToLevel(); 97 AddCollisionHandler(pallo, KasittelePallonTormaus); 71 98 } 72 99 void AloitaPeli() … … 98 125 void LisaaLaskurit() 99 126 { 127 pelaajan1Pisteet = LuoPisteLaskuri(Screen.Left + 100.0, Screen.Top - 100.0); 128 pelaajan2Pisteet = LuoPisteLaskuri(Screen.Right - 100.0, Screen.Top - 100.0); 100 129 101 IntMeter LuoPisteLaskuri() 102 { 103 IntMeter laskuri = new IntMeter(0); 104 laskuri.MaxValue = 10; 105 return laskuri; 106 107 } 130 108 131 109 132 … … 111 134 112 135 } 136 IntMeter LuoPisteLaskuri(double x, double y) 137 { 138 IntMeter laskuri = new IntMeter(0); 139 laskuri.MaxValue = 10; 140 141 Label naytto = new Label(); 142 naytto.BindTo(laskuri); 143 naytto.X = x; 144 naytto.Y = y; 145 naytto.TextColor = Color.White; 146 naytto.BorderColor = Level.Background.Color; 147 naytto.Color = Level.Background.Color; 148 Add(naytto); 149 return laskuri; 150 151 152 } 113 153 } 114 154
Note: See TracChangeset
for help on using the changeset viewer.