- Timestamp:
- 2014-06-12 14:51:34 (9 years ago)
- Location:
- 2014/24/JuhoJ/ShotgunJoe/ShotgunJoe
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/24/JuhoJ/ShotgunJoe/ShotgunJoe/ShotgunJoe/ShotgunJoe.cs
r4972 r4976 9 9 public class ShotgunJoe : PhysicsGame 10 10 { 11 // TODO laatikot putoaa näkymättömien seinien läpi 12 // TODO tynnyrit ei saa räjäyttää lattiaa 13 // TODO 11 12 // TODO laatikot pitää pystyä tuhoamaan 13 // TODO panoslaskuri näkyviin 14 // TODO elämät täyteen kenttien välissä 15 // TODO voittamattomuus 14 16 const double nopeus = 200; 15 17 const double hyppyNopeus = 550; 16 18 const int RUUDUN_KOKO = 40; 17 18 19 20 bool onKuolematon = false; 21 22 19 23 PlatformCharacter pelaaja1; 20 24 PlasmaCannon pelaajan1Ase; … … 36 40 Image tynnyrikuva = LoadImage("tynnyri"); 37 41 Image laatikkokuva = LoadImage("laatikko"); 42 SoundEffect haulikkoaani = LoadSoundEffect("haulikkoaani"); 38 43 public override void Begin() 39 44 { 45 SmoothTextures = false; 40 46 Gravity = new Vector(0, -1000); 41 47 … … 47 53 48 54 Timer ajastin = new Timer(); 49 ajastin.Interval = 1.5;55 ajastin.Interval = 2.0; 50 56 ajastin.Timeout += RandomUusiLaatikko; 51 57 ajastin.Start(); … … 58 64 pelaaja1.Weapon.Image = asekuva; 59 65 pelaaja1.Weapon.Ammo.Value = 100; 60 pelaaja1.Weapon.ProjectileCollision = AmmusOsui; 66 pelaaja1.Weapon.ProjectileCollision = AmmusOsui; 67 61 68 pelaaja1.Weapon.FireRate = 1.0; 62 69 … … 66 73 { 67 74 TileMap kentta = TileMap.FromLevelAsset("kentta1"); 68 kentta.SetTileMethod('#', Lisaa Taso);75 kentta.SetTileMethod('#', LisaaMulta); 69 76 kentta.SetTileMethod('*', LisaaTahti); 70 77 kentta.SetTileMethod('J', LisaaPelaaja); … … 72 79 kentta.SetTileMethod('R', LisaaRuoho); 73 80 kentta.SetTileMethod('V', LisaaVihu); 74 kentta.SetTileMethod('N', LisaaN äkymätön);81 kentta.SetTileMethod('N', LisaaNakymaton); 75 82 kentta.SetTileMethod('T', LisaaTynnyri); 76 83 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); … … 79 86 } 80 87 81 void LisaaTaso(Vector paikka, double leveys, double korkeus) 88 void LisaaMulta(Vector paikka, double leveys, double korkeus) 89 { 90 LisaaPalikka(paikka, leveys, korkeus, "maa", multakuva,0); 91 } 92 void LisaaRuoho(Vector paikka, Double leveys, Double korkeus) 93 { 94 LisaaPalikka(paikka, leveys, korkeus, "ruoho", ruohokuva,0); 95 } 96 97 void LisaaPalikka(Vector paikka, Double leveys, Double korkeus,string tagi,Image kuva, int ignoregroup) 82 98 { 83 99 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 84 100 taso.Position = paikka; 85 taso.Image = multakuva;101 taso.Image = kuva; 86 102 taso.IgnoresExplosions = true; 103 if (ignoregroup > 0) 104 { 105 taso.CollisionIgnoreGroup = ignoregroup; 106 } 87 107 Add(taso); 88 108 } … … 157 177 } 158 178 159 void LisaaRuoho(Vector paikka, Double leveys, Double korkeus) 160 { 161 PhysicsObject ruoho = PhysicsObject.CreateStaticObject(leveys, korkeus); 162 ruoho.Tag = "ruoho"; 163 ruoho.Position = paikka; 164 ruoho.Image = ruohokuva; 165 ruoho.IgnoresExplosions = true; 166 Add(ruoho); 167 168 } 179 169 180 170 181 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) … … 201 212 if (ammus != null) 202 213 { 214 haulikkoaani.Play(); 203 215 //ammus.Size *= 3; 204 216 ammus.Image = panoskuva; … … 217 229 Add(vihu); 218 230 FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja1); 231 vihu.CollisionIgnoreGroup = 2; 219 232 vihu.Brain = seuraajanAivot; 220 233 221 234 } 222 235 223 void LisaaNäkymätön(Vector paikka, Double leveys, Double korkeus) 224 { 225 PhysicsObject näkymätön = PhysicsObject.CreateStaticObject(leveys, korkeus); 226 näkymätön.Tag = "näkymätön"; 227 näkymätön.Position = paikka; 228 näkymätön.Image = näkymätönkuva; 229 Add(näkymätön); 236 void LisaaNakymaton(Vector paikka, Double leveys, Double korkeus) 237 { 238 LisaaPalikka(paikka, leveys, korkeus, "näkymätön", näkymätönkuva,2); 230 239 } 231 240 … … 259 268 void TormaaVihuun(PhysicsObject hahmo, PhysicsObject vihu) 260 269 { 261 elamalaskuri.Value -= 1; 270 if (!onKuolematon) 271 { 272 elamalaskuri.Value -= 1; 273 onKuolematon = true; 274 Timer.SingleShot(0.5, delegate { onKuolematon = false; }); 275 } 276 277 262 278 } 263 279 … … 274 290 tynnyri.Position = paikka; 275 291 tynnyri.Image = tynnyrikuva; 292 tynnyri.CollisionIgnoreGroup = 2; 276 293 Add(tynnyri); 277 294 } … … 280 297 Double Y = Level.Top - 25; 281 298 Double X = RandomGen.NextDouble(Level.Left, Level.Right); 282 PhysicsObject laatikko = new PhysicsObject(50, 50);299 Laatikko laatikko = new Laatikko(50, 50); 283 300 laatikko.Position = new Vector(X, Y); 284 301 laatikko.Tag = "laatikko"; 285 302 laatikko.Image = laatikkokuva; 303 laatikko.CollisionIgnoreGroup = 2; 304 laatikko.spawnausajstin.Timeout += delegate { 305 LisaaVihu((laatikko.Position + new Vector(0, laatikko.Height/2.0 + RUUDUN_KOKO/2.0)), RUUDUN_KOKO, RUUDUN_KOKO); 306 }; 307 286 308 Add(laatikko); 287 309 } -
2014/24/JuhoJ/ShotgunJoe/ShotgunJoe/ShotgunJoe/ShotgunJoe.csproj
r4939 r4976 111 111 </ItemGroup> 112 112 <ItemGroup> 113 <Compile Include="Laatikko.cs" /> 113 114 <Compile Include="Ohjelma.cs" /> 114 115 <Compile Include="ShotgunJoe.cs" /> -
2014/24/JuhoJ/ShotgunJoe/ShotgunJoe/ShotgunJoe/ShotgunJoe.csproj.Debug.cachefile
r4972 r4976 7 7 Content\Ruoho.xnb 8 8 Content\multa.xnb 9 Content\haulikko.xnb10 9 Content\ammus.xnb 11 10 Content\Vihu.xnb … … 13 12 Content\tynnyri.xnb 14 13 Content\laatikko.xnb 14 Content\haulikkoaani.xnb 15 Content\haulikko.xnb -
2014/24/JuhoJ/ShotgunJoe/ShotgunJoe/ShotgunJoe/obj/x86/Debug/ContentPipeline-{CF60888C-4746-4871-9D32-E8426663FBA0}.xml
r4972 r4976 75 75 </Item> 76 76 <Item> 77 <Source>haulikko.png</Source>78 <Name>haulikko</Name>79 <Importer>TextureImporter</Importer>80 <Processor>TextureProcessor</Processor>81 <Options>None</Options>82 <Output>C:\MyTemp\JuhoJ\ShotgunJoe\ShotgunJoe\ShotgunJoe\bin\x86\Debug\Content\haulikko.xnb</Output>83 <Time>2014-06-11T12:21:36.8419572+03:00</Time>84 </Item>85 <Item>86 77 <Source>ammus.png</Source> 87 78 <Name>ammus</Name> … … 127 118 <Output>C:\MyTemp\JuhoJ\ShotgunJoe\ShotgunJoe\ShotgunJoe\bin\x86\Debug\Content\laatikko.xnb</Output> 128 119 <Time>2014-06-12T12:42:49.6609945+03:00</Time> 120 </Item> 121 <Item> 122 <Source>haulikkoaani.wav</Source> 123 <Name>haulikkoaani</Name> 124 <Importer>WavImporter</Importer> 125 <Processor>SoundEffectProcessor</Processor> 126 <Options>None</Options> 127 <Output>C:\MyTemp\JuhoJ\ShotgunJoe\ShotgunJoe\ShotgunJoe\bin\x86\Debug\Content\haulikkoaani.xnb</Output> 128 <Time>2014-06-12T13:54:15.2691796+03:00</Time> 129 </Item> 130 <Item> 131 <Source>haulikko.png</Source> 132 <Name>haulikko</Name> 133 <Importer>TextureImporter</Importer> 134 <Processor>TextureProcessor</Processor> 135 <Options>None</Options> 136 <Output>C:\MyTemp\JuhoJ\ShotgunJoe\ShotgunJoe\ShotgunJoe\bin\x86\Debug\Content\haulikko.xnb</Output> 137 <Time>2014-06-11T12:21:36.8419572+03:00</Time> 129 138 </Item> 130 139 <BuildSuccessful>true</BuildSuccessful> -
2014/24/JuhoJ/ShotgunJoe/ShotgunJoe/ShotgunJoe/obj/x86/Debug/ShotgunJoe.csproj.FileListAbsolute.txt
r4972 r4976 21 21 C:\MyTemp\JuhoJ\ShotgunJoe\ShotgunJoe\ShotgunJoe\bin\x86\Debug\Content\tynnyri.xnb 22 22 C:\MyTemp\JuhoJ\ShotgunJoe\ShotgunJoe\ShotgunJoe\bin\x86\Debug\Content\laatikko.xnb 23 C:\MyTemp\JuhoJ\ShotgunJoe\ShotgunJoe\ShotgunJoe\bin\x86\Debug\Content\haulikkoaani.xnb -
2014/24/JuhoJ/ShotgunJoe/ShotgunJoe/ShotgunJoe/obj/x86/Debug/cachefile-{CF60888C-4746-4871-9D32-E8426663FBA0}-targetpath.txt
r4972 r4976 7 7 Content\Ruoho.xnb 8 8 Content\multa.xnb 9 Content\haulikko.xnb10 9 Content\ammus.xnb 11 10 Content\Vihu.xnb … … 13 12 Content\tynnyri.xnb 14 13 Content\laatikko.xnb 14 Content\haulikkoaani.xnb 15 Content\haulikko.xnb -
2014/24/JuhoJ/ShotgunJoe/ShotgunJoe/ShotgunJoeContent/ShotgunJoeContent.contentproj
r4972 r4976 137 137 </Compile> 138 138 </ItemGroup> 139 <ItemGroup> 140 <Compile Include="haulikkoaani.wav"> 141 <Name>haulikkoaani</Name> 142 <Importer>WavImporter</Importer> 143 <Processor>SoundEffectProcessor</Processor> 144 </Compile> 145 </ItemGroup> 139 146 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 140 147 <!-- 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.