- Timestamp:
- 2011-06-14 15:00:03 (12 years ago)
- Location:
- 2011/24/MiskaK/Sniper
- Files:
-
- 21 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/24/MiskaK/Sniper/Sniper/Sniper/Peli.cs
r1983 r1997 14 14 ExplosionSystem rajahdys; 15 15 PhysicsObject tähtäin; 16 Timer ajastin; 17 PhysicsObject ammusmittari; 16 18 Image taulunKuva = LoadImage("maalitaulu"); 17 19 Image tähtäimenKuva = LoadImage("tähtäin2"); 20 Image tähtäimenLatausKuva = LoadImage("loadtähtäin"); 18 21 Image savuHiukkanen = LoadImage("savuhiukkanen"); 22 Image räjähdysHiukkanen = LoadImage("räjähdyshiukkanen"); 23 int pMaxMaara = 500; 24 25 double grav = -200.0; 19 26 20 27 public override void Begin() 21 28 { 22 29 LuoTähtäin(); 23 LuoMaalitaulu(200.0, 200.0); 30 LuoMaalitaulu(RandomGen.NextDouble(-400.0, 400.0) , 400.0); 31 24 32 AsetaOhjaimet(); 25 LuoKenttä(); 33 LuoKenttä(grav); 34 LuoAmmusMittari(); 26 35 27 36 } … … 36 45 tähtäin.CanRotate = false; 37 46 47 ajastin = new Timer(); 48 ajastin.Interval = 0.5; 49 ajastin.Trigger += HeilutaTähtäintä; 50 ajastin.Start(); 51 52 53 54 38 55 Add(tähtäin, 1); 39 56 } 40 57 41 void LuoKenttä() 58 void LuoAmmusMittari() 59 { 60 ammusmittari = new PhysicsObject(300, 300); 61 62 63 } 64 65 void HeilutaTähtäintä(Timer sender) 66 { 67 68 69 } 70 71 void LuoKenttä(double painovoima) 42 72 { 43 73 Level.BackgroundColor = Color.Black; 44 Gravity = new Vector(0.0, -80.0);74 Gravity = new Vector(0.0, painovoima); 45 75 46 76 liekki = new Flame(savuHiukkanen); 47 //rajahdys = new ExplosionSystem( 77 rajahdys = new ExplosionSystem(räjähdysHiukkanen, pMaxMaara); 78 Add(rajahdys); 48 79 } 49 80 … … 51 82 { 52 83 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu"); 53 Mouse.ListenOn(maalitaulu, MouseButton.Left, ButtonState.Pressed, Ammu, null); 84 Keyboard.Listen(Key.Space, ButtonState.Down, AimBot, null); 85 Keyboard.Listen(Key.R, ButtonState.Pressed, LataaAse, "Lataa ase"); 54 86 55 87 … … 59 91 } 60 92 93 void LataaAse() 94 { 95 Timer.SingleShot(2.0, LataaAse2); 96 97 } 98 99 void LataaAse2() 100 { 101 tähtäin.Image = tähtäimenKuva; 102 } 103 104 void AimBot() 105 { 106 tähtäin.Position = maalitaulu.Position; 107 } 108 61 109 void Ammu() 62 { 63 Add(liekki); 64 Timer.SingleShot(1.0, RajaytaTaulu); 110 { 111 if (tähtäin.Image == tähtäimenLatausKuva) 112 { 113 MessageDisplay.TextColor = Color.White; 114 MessageDisplay.Add(" You have no ammo. Press R to reload weapon."); 115 } 116 117 else 118 { 119 liekki = new Flame(savuHiukkanen); 120 Add(liekki); 121 Timer.SingleShot(2.0, RajaytaTaulu); 122 tähtäin.Image = tähtäimenLatausKuva; 123 } 65 124 } 66 125 67 126 void RajaytaTaulu() 68 127 { 128 double x = maalitaulu.X; 129 double y = maalitaulu.Y; 130 rajahdys.AddEffect(x, y, 200); 131 maalitaulu.Destroy(); 132 133 Timer.SingleShot(1.0, SammutaLiekki); 134 135 69 136 70 137 } 71 138 72 void LuoMaalitaulu( double x, double y)139 void SammutaLiekki() 73 140 { 74 maalitaulu = new PhysicsObject(100, 100); 141 liekki.Destroy(); 142 liekki = new Flame(savuHiukkanen); 143 grav = grav + 20; 144 LuoMaalitaulu(RandomGen.NextDouble(-400.0, 400.0), 200.0); 145 146 147 } 148 149 void LuoMaalitaulu( double x, double y ) 150 { 151 maalitaulu = new PhysicsObject( 100.0, 100.0); 75 152 maalitaulu.Image = taulunKuva; 76 153 maalitaulu.X = x; 77 154 maalitaulu.Y = y; 155 maalitaulu.Mass = 5000; 156 157 158 Mouse.ListenOn(maalitaulu, MouseButton.Left, ButtonState.Pressed, Ammu, null); 159 78 160 Add(maalitaulu); 161 //maalitaulu.Hit(new Vector(0, -8000)); 162 163 164 79 165 } 80 166 … … 95 181 liekki.Position = maalitaulu.Position; 96 182 } 183 184 97 185 98 186 base.Update(time); -
2011/24/MiskaK/Sniper/Sniper/Sniper/Sniper.csproj
r1983 r1997 116 116 </ItemGroup> 117 117 <ItemGroup> 118 <Content Include="ammukset0.png" /> 119 <Content Include="ammukset1.png" /> 118 120 <Content Include="Game.ico" /> 119 121 <Content Include="GameThumbnail.png" /> 122 <Content Include="loadtähtäin.png" /> 123 <Content Include="loadtähtäin2.png" /> 120 124 <Content Include="maalitaulu.png" /> 125 <Content Include="räjähdyshiukkanen.png" /> 121 126 <Content Include="savuhiukkanen.png" /> 127 <Content Include="tähtäin3.png" /> 122 128 </ItemGroup> 123 129 <ItemGroup> -
2011/24/MiskaK/Sniper/Sniper/SniperContent/SniperContent.contentproj
r1983 r1997 63 63 </Compile> 64 64 </ItemGroup> 65 <ItemGroup> 66 <Compile Include="räjähdyshiukkanen.png"> 67 <Name>räjähdyshiukkanen</Name> 68 <Importer>TextureImporter</Importer> 69 <Processor>TextureProcessor</Processor> 70 </Compile> 71 </ItemGroup> 72 <ItemGroup> 73 <Compile Include="loadtähtäin.png"> 74 <Name>loadtähtäin</Name> 75 <Importer>TextureImporter</Importer> 76 <Processor>TextureProcessor</Processor> 77 </Compile> 78 </ItemGroup> 79 <ItemGroup> 80 <Compile Include="loadtähtäin2.png"> 81 <Name>loadtähtäin2</Name> 82 <Importer>TextureImporter</Importer> 83 <Processor>TextureProcessor</Processor> 84 </Compile> 85 </ItemGroup> 86 <ItemGroup> 87 <Compile Include="tähtäin3.png"> 88 <Name>tähtäin3</Name> 89 <Importer>TextureImporter</Importer> 90 <Processor>TextureProcessor</Processor> 91 </Compile> 92 </ItemGroup> 93 <ItemGroup> 94 <Compile Include="ammukset0.png"> 95 <Name>ammukset0</Name> 96 <Importer>TextureImporter</Importer> 97 <Processor>TextureProcessor</Processor> 98 </Compile> 99 <Compile Include="ammukset1.png"> 100 <Name>ammukset1</Name> 101 <Importer>TextureImporter</Importer> 102 <Processor>TextureProcessor</Processor> 103 </Compile> 104 </ItemGroup> 65 105 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 66 106 <!-- 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.