Changeset 7751
- Timestamp:
- 2016-07-05 10:49:44 (5 years ago)
- Location:
- 2016/27/OskariL/Pong
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/27/OskariL/Pong/Pong/Pong/Pong.cs
r7717 r7751 9 9 public class Pong : PhysicsGame 10 10 { 11 ExplosionSystem rajahtaa = new ExplosionSystem(LoadImage("Pulla"), 200); 11 ExplosionSystem rajahtaa = new ExplosionSystem(LoadImage("Pulla"), 400); 12 ExplosionSystem numminenRajahtaa = new ExplosionSystem(LoadImage("M_A_Numminen_2011"), 400); 12 13 13 14 Vector nopeusYlos = new Vector(0, 650); 14 15 Vector nopeusAlas = new Vector(0, -650); 16 Vector impulssi; 17 Vector impulssi2; 15 18 16 19 PhysicsObject pallo; 17 20 PhysicsObject maila1; 18 21 PhysicsObject maila2; 22 PhysicsObject ammus; 19 23 20 24 PhysicsObject vasenReuna; … … 26 30 Boolean hasGameEnded = false; 27 31 Boolean hasRajahtanyt = false; 32 Boolean hasNumminenRajahtanyt = false; 33 Boolean isTimerRunning = false; 28 34 29 35 DoubleMeter alaspainLaskuri; … … 55 61 56 62 maila1 = LuoMaila(Level.Left + 20.0, 0.0); 63 maila1.Tag = "maila"; 64 maila1.CollisionIgnoreGroup = 2; 57 65 maila2 = LuoMaila(Level.Right - 20.0, 0.0); 66 maila2.Tag = "maila"; 67 maila2.CollisionIgnoreGroup = 2; 58 68 59 69 //luodaan kenttä … … 61 71 vasenReuna.Restitution = 1.0; 62 72 vasenReuna.IsVisible = false; 73 vasenReuna.CollisionIgnoreGroup = 1; 74 vasenReuna.Tag = "seina"; 63 75 oikeaReuna = Level.CreateRightBorder(); 64 76 oikeaReuna.Restitution = 1.0; 65 77 oikeaReuna.IsVisible = false; 78 oikeaReuna.CollisionIgnoreGroup = 1; 79 oikeaReuna.Tag = "seina"; 66 80 PhysicsObject alaReuna = Level.CreateBottomBorder(); 67 81 alaReuna.Restitution = 1.0; 68 82 alaReuna.IsVisible = false; 83 alaReuna.CollisionIgnoreGroup = 1; 84 alaReuna.Tag = "seina"; 69 85 PhysicsObject ylaReuna = Level.CreateTopBorder(); 70 86 ylaReuna.Restitution = 1.0; 71 87 ylaReuna.IsVisible = false; 88 ylaReuna.CollisionIgnoreGroup = 1; 89 ylaReuna.Tag = "seina"; 72 90 73 91 Level.Background.Color = Color.Black; … … 78 96 { 79 97 //liikutetaan palloa 80 Vectorimpulssi = new Vector(500.0, 0.0);98 impulssi = new Vector(500.0, 0.0); 81 99 pallo.Hit(impulssi); 82 100 impulssi2 = new Vector(-500.0, 0.0); 83 101 } 84 102 PhysicsObject LuoMaila(double x, double y) … … 101 119 Keyboard.Listen(Key.Z, ButtonState.Released, AsetaNopeus, null, maila1, Vector.Zero); 102 120 121 Keyboard.Listen(Key.X, ButtonState.Down, AmmuPalloa1, "Pelaaja 1: Ammu"); 122 103 123 //pelaajan 2 napit 104 124 Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa ylös", maila2, nopeusYlos); … … 106 126 Keyboard.Listen(Key.Down, ButtonState.Down, AsetaNopeus, "Pelaaja 2: Liikuta mailaa alas", maila2, nopeusAlas); 107 127 Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, maila2, Vector.Zero); 128 129 Keyboard.Listen(Key.Left, ButtonState.Down, AmmuPalloa2, "Pelaaja 2: Ammu"); 108 130 109 131 //yleiset napit … … 164 186 { 165 187 pelaajan2Pisteet.Value += 1; 166 Rajahdys(); 167 //TODO: tee erillinen räjähdys Putineista 188 RajahdysNumminen(); 168 189 } 169 190 if (pelaajan1Pisteet == 10) … … 177 198 MessageDisplay.Add("Pelaaja 2 voittaa"); 178 199 LuoAikaLaskuri(); 179 Rajahdys(); 180 //TODO: tee erillinen räjähdys Putineista 181 200 RajahdysNumminen(); 182 201 } 183 202 } 184 203 void LuoAikaLaskuri() 185 204 { 205 if (isTimerRunning == true) 206 { 207 return; 208 } 209 186 210 alaspainLaskuri = new DoubleMeter(5); 187 211 … … 197 221 aikaNaytto.BindTo(alaspainLaskuri); 198 222 Add(aikaNaytto); 223 isTimerRunning = true; 199 224 } 200 225 void AikaLoppui() … … 224 249 double x = 0; 225 250 double y = 0; 226 int pMaara = 200;251 int pMaara = 400; 227 252 rajahtaa.AddEffect(x, y, pMaara); 228 253 } 254 void RajahdysNumminen() 255 { 256 if (hasNumminenRajahtanyt == false) 257 { 258 hasNumminenRajahtanyt = true; 259 Add(numminenRajahtaa); 260 } 261 double x = 0; 262 double y = 0; 263 int pMaara = 400; 264 numminenRajahtaa.AddEffect(x, y, pMaara); 265 266 267 } 268 void AmmuPalloa1() 269 { 270 LuoAmmus(maila1.X + 10.0, maila1.Y); 271 ammus.Hit(impulssi); 272 } 273 void AmmuPalloa2() 274 { 275 LuoAmmus(maila2.X - 10.0, maila2.Y); 276 ammus.Hit(impulssi2); 277 } 278 void LuoAmmus(double x, double y) 279 { 280 ammus = new PhysicsObject(10.0, 10.0); 281 ammus.X = x; 282 ammus.Y = y; 283 ammus.Shape = Shape.Star; 284 Add(ammus); 285 AddCollisionHandler(ammus, "seina", CollisionHandler.DestroyObject); 286 ammus.CollisionIgnoreGroup = 2; 287 } 229 288 } -
2016/27/OskariL/Pong/Pong/Pong/obj/x86/Debug/ContentPipeline-{BFDFC922-70FE-421D-A674-E0C408BE6EAF}.xml
r7717 r7751 10 10 <Output>C:\MyTemp\OskariL\Pong\Pong\Pong\bin\x86\Debug\Content\Pulla.xnb</Output> 11 11 <Time>2016-07-04T14:24:56.5987405+03:00</Time> 12 </Item> 13 <Item> 14 <Source>M_A_Numminen_2011.jpg</Source> 15 <Name>M_A_Numminen_2011</Name> 16 <Importer>TextureImporter</Importer> 17 <Processor>TextureProcessor</Processor> 18 <Options>None</Options> 19 <Output>C:\MyTemp\OskariL\Pong\Pong\Pong\bin\x86\Debug\Content\M_A_Numminen_2011.xnb</Output> 20 <Time>2016-07-05T10:01:41.3064143+03:00</Time> 12 21 </Item> 13 22 <BuildSuccessful>true</BuildSuccessful> -
2016/27/OskariL/Pong/Pong/Pong/obj/x86/Debug/Pong.csproj.FileListAbsolute.txt
r7717 r7751 8 8 C:\MyTemp\OskariL\Pong\Pong\Pong\obj\x86\Debug\Pong.pdb 9 9 C:\MyTemp\OskariL\Pong\Pong\Pong\bin\x86\Debug\Content\Pulla.xnb 10 C:\MyTemp\OskariL\Pong\Pong\Pong\bin\x86\Debug\Content\M_A_Numminen_2011.xnb -
2016/27/OskariL/Pong/Pong/PongContent/PongContent.contentproj
r7717 r7751 52 52 </Compile> 53 53 </ItemGroup> 54 <ItemGroup> 55 <Compile Include="M_A_Numminen_2011.jpg"> 56 <Name>M_A_Numminen_2011</Name> 57 <Importer>TextureImporter</Importer> 58 <Processor>TextureProcessor</Processor> 59 </Compile> 60 </ItemGroup> 54 61 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 55 62 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.