- Timestamp:
- 2012-06-13 15:04:34 (11 years ago)
- Location:
- 2012/24/EeroF
- Files:
-
- 56 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/24/EeroF/Bong/Bong/Bong/Bong.cs
r2949 r3003 19 19 IntMeter pelaajan1Pisteet; 20 20 IntMeter pelaajan2Pisteet; 21 22 21 PhysicsObject vasenReuna; 22 PhysicsObject oikeaReuna; 23 23 public override void Begin() 24 24 { … … 48 48 pallo.Color = Color.OrangeRed; 49 49 pallo.Restitution = 1; 50 // pallo.Gravity (200);50 AddCollisionHandler(pallo,tormaus); 51 51 52 Level.CreateBorders(1, false); 52 vasenReuna = Level.CreateLeftBorder(); 53 vasenReuna.Restitution = 1.0; 54 vasenReuna.IsVisible = false; 55 56 oikeaReuna = Level.CreateRightBorder(); 57 oikeaReuna.Restitution = 1.0; 58 oikeaReuna.IsVisible = false; 59 60 PhysicsObject ylaReuna = Level.CreateTopBorder(); 61 ylaReuna.Restitution = 1.0; 62 ylaReuna.IsVisible = false; 63 64 PhysicsObject alaReuna = Level.CreateBottomBorder(); 65 alaReuna.Restitution = 1.0; 66 alaReuna.IsVisible = false; 53 67 54 68 Level.BackgroundColor = Color.Cyan; 55 69 Camera.ZoomToLevel(); 70 LisaaLaskurit(); 71 56 72 57 73 } … … 125 141 126 142 127 }128 IntMeter LuoPiste laskuri (double x, double y)143 144 IntMeter LuoPisteLaskuri (double x, double y) 129 145 { 130 146 IntMeter laskuri = new IntMeter(0); 131 147 132 148 laskuri.MaxValue = 10; 133 Label naytto = new Label (0); 149 150 151 Label naytto = new Label (); 134 152 naytto.BindTo(laskuri); 135 153 naytto.X = x; … … 141 159 return laskuri; 142 160 143 144 161 } 162 void tormaus(PhysicsObject pallo, PhysicsObject kohde) 163 { 164 if (kohde == oikeaReuna) 165 { 166 pelaajan1Pisteet.Value += 1; 167 } 168 else if (kohde == vasenReuna) 169 { 170 pelaajan2Pisteet.Value += 1; 171 } 145 172 146 173 147 174 148 149 150 175 } 151 176 } 152 177
Note: See TracChangeset
for help on using the changeset viewer.