- Timestamp:
- 2014-07-03 14:57:07 (7 years ago)
- Location:
- 2014/27/JesseL
- Files:
-
- 6 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/27/JesseL/Trapp/Trapp/Trapp/Trapp.cs
r5331 r5370 10 10 { 11 11 12 const double nopeus = 200;13 const double hyppyNopeus = 750;12 const double nopeus = 1000; 13 const double hyppyNopeus = 10750; 14 14 const int RUUDUN_KOKO = 40; 15 15 … … 32 32 33 33 Camera.Follow(pelaaja1); 34 Camera.ZoomFactor = 1.2;34 Camera.ZoomFactor = 0.9; 35 35 Camera.StayInLevel = true; 36 36 SetWindowSize(1024, 768, true); … … 41 41 void LuoKentta() 42 42 { 43 TileMap kentta = TileMap.FromLevelAsset("kentta1");44 kentta.SetTileMethod('#', LisaaTaso);45 kentta.SetTileMethod('*', LisaaTahti);46 kentta.SetTileMethod('N', LisaaPelaaja);47 kentta.SetTileMethod('P', LisaaVihollinen);48 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO);49 Level.CreateBorders();43 //TileMap kentta = TileMap.FromLevelAsset("kentta1"); 44 //kentta.SetTileMethod('#', LisaaTaso); 45 //kentta.SetTileMethod('*', LisaaTahti); 46 //kentta.SetTileMethod('N', LisaaPelaaja); 47 //kentta.SetTileMethod('P', LisaaVihollinen); 48 //kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 49 50 50 Level.Background.CreateGradient(Color.White, Color.SkyBlue); 51 51 SmoothTextures = false; 52 53 //1. Luetaan kuva uuteen ColorTileMappiin, kuvan nimen perässä ei .png-päätettä. 54 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("11223344"); 55 56 //2. Kerrotaan mitä aliohjelmaa kutsutaan, kun tietyn värinen pikseli tulee vastaan kuvatiedostossa. 57 ruudut.SetTileMethod(Color.YellowGreen, LisaaPelaaja); 58 ruudut.SetTileMethod(Color.Black, LisaaTaso); 59 ruudut.SetTileMethod(Color.Red, LisaaVihollinen); 60 61 //3. Execute luo kentän 62 // Parametreina leveys ja korkeus 63 ruudut.Execute(100, 100); 52 64 53 65 } … … 57 69 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 58 70 taso.Position = paikka; 59 taso.Color = Color. Green;71 taso.Color = Color.Black; 60 72 Add(taso); 61 73 } 74 75 76 77 78 62 79 63 80 void LisaaTahti(Vector paikka, double leveys, double korkeus) … … 75 92 pelaaja1 = new PlatformCharacter(leveys, korkeus); 76 93 pelaaja1.Position = paikka; 77 pelaaja1.Mass = 4.0;94 pelaaja1.Mass = 1000.0; 78 95 pelaaja1.Image = pelaajanKuva; 79 96 AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 80 97 Add(pelaaja1); 81 98 82 pelaaja1.Weapon = new AssaultRifle(20, 5); 83 pelaaja1.Weapon.ProjectileCollision = AmmusOsui; 99 //pelaaja1.Weapon = new AssaultRifle(1, 1); 100 //pelaaja1.Weapon.Ammo.Value = 1000; 101 //pelaaja1.Weapon.ProjectileCollision = AmmusOsui; 102 103 //pelaaja1.Weapon.Image = null; 104 84 105 } 106 //void AmmuAseella(PlatformCharacter pelaaja) 107 //{ 108 //PhysicsObject ammus = pelaaja.Weapon.Shoot(); 109 110 //if (ammus != null) 111 //{ 112 //ammus.Size *= 3; 113 //ammus.Image = ... 114 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 115 //} 116 //} 117 //void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 118 //{ 119 //ammus.Destroy(); 120 //} 85 121 void LisaaVihollinen(Vector paikka, double leveys, double korkeus) 86 122 { 87 PlatformCharacter pahis = new PlatformCharacter( 40, 20 ); 88 pahis.Shape = Shape.Rectangle; 89 pahis.Mass = 10.0; 123 PlatformCharacter pahis = new PlatformCharacter(leveys, korkeus); 90 124 Add(pahis); 125 126 PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 127 tasoAivot.Speed = 100; 128 pahis.Brain = tasoAivot; 129 } 130 void LisaaPunTaso(Vector paikka, double leveys, double korkeus) 131 { 132 PhysicsObject PunTaso = PhysicsObject.CreateStaticObject(leveys, korkeus); 133 PunTaso.Position = paikka; 134 PunTaso.Color = Color.Red; 135 91 136 } 92 137 … … 100 145 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 101 146 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 147 //Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pelaaja1); 102 148 103 149 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); … … 112 158 113 159 114 void Liikuta(PlatformCharacter hahmo, double nopeus)160 void Liikuta(PlatformCharacter hahmo, double nopeus) 115 161 { 116 162 hahmo.Walk(nopeus); … … 128 174 tahti.Destroy(); 129 175 } 176 130 177 } -
2014/27/JesseL/Trapp/Trapp/Trapp/Trapp.csproj.Debug.cachefile
r5331 r5370 4 4 Content\kentta1.xnb 5 5 Content\Pelattava hahmo.xnb 6 Content\11223344.xnb -
2014/27/JesseL/Trapp/Trapp/Trapp/obj/x86/Debug/ContentPipeline-{656556C8-AC05-4A57-8FA6-6AA1AA386918}.xml
r5331 r5370 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\JesseL\Trapp\Trapp\Trapp\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2014-07-03T1 0:51:59.8372013+03:00</Time>38 <Time>2014-07-03T13:58:13.4666992+03:00</Time> 39 39 </Item> 40 40 <Item> … … 46 46 <Output>C:\MyTemp\JesseL\Trapp\Trapp\Trapp\bin\x86\Debug\Content\Pelattava hahmo.xnb</Output> 47 47 <Time>2014-07-03T10:17:58.5410498+03:00</Time> 48 </Item> 49 <Item> 50 <Source>11223344.png</Source> 51 <Name>11223344</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 <Options>None</Options> 55 <Output>C:\MyTemp\JesseL\Trapp\Trapp\Trapp\bin\x86\Debug\Content\11223344.xnb</Output> 56 <Time>2014-07-03T14:34:58.9172222+03:00</Time> 48 57 </Item> 49 58 <BuildSuccessful>true</BuildSuccessful> -
2014/27/JesseL/Trapp/Trapp/Trapp/obj/x86/Debug/Trapp.csproj.FileListAbsolute.txt
r5331 r5370 12 12 C:\MyTemp\JesseL\Trapp\Trapp\Trapp\obj\x86\Debug\Trapp.pdb 13 13 C:\MyTemp\JesseL\Trapp\Trapp\Trapp\bin\x86\Debug\Content\Pelattava hahmo.xnb 14 C:\MyTemp\JesseL\Trapp\Trapp\Trapp\bin\x86\Debug\Content\11223344.xnb -
2014/27/JesseL/Trapp/Trapp/Trapp/obj/x86/Debug/cachefile-{656556C8-AC05-4A57-8FA6-6AA1AA386918}-targetpath.txt
r5331 r5370 4 4 Content\kentta1.xnb 5 5 Content\Pelattava hahmo.xnb 6 Content\11223344.xnb -
2014/27/JesseL/Trapp/Trapp/TrappContent/TrappContent.contentproj
r5331 r5370 74 74 </Compile> 75 75 </ItemGroup> 76 <ItemGroup> 77 <Compile Include="11223344.png"> 78 <Name>11223344</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 </Compile> 82 </ItemGroup> 76 83 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 77 84 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2014/27/JesseL/Trapp/Trapp/TrappContent/kentta1.txt
r5331 r5370 2 2 ## 3 3 4 * *4 * *P 5 5 ## ## 6 6 7 * *7 * PP * 8 8 ## ## ## 9 9 10 * * * 10 * * * P* 11 11 ## ## ## ## 12 13 * * * *14 ## ## ## ## ## 15 16 N P 17 ###################### 12 # # 13 * * PP * p* # # 14 ## ## ## ## ## # # 15 # # 16 N P # 17 ##############################################
Note: See TracChangeset
for help on using the changeset viewer.