- Timestamp:
- 2016-06-30 15:05:21 (3 years ago)
- Location:
- 2016/26/SallaK
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/26/SallaK/Sandwich/Sandwich/Sandwich/Sandwich.cs
r7593 r7604 7 7 using Jypeli.Widgets; 8 8 9 public class Sandwich : PhysicsGame 9 10 public class Sandwich : PhysicsGame 10 11 { 11 12 const double nopeus = 200; … … 13 14 const int RUUDUN_KOKO = 40; 14 15 15 PlatformCharacter pelaaja1; 16 17 18 19 IntMeter juusto; 20 IntMeter tomaatti; 21 IntMeter leipä; 22 IntMeter salaatti; 23 IntMeter kala; 24 IntMeter voi; 25 16 26 IntMeter pisteLaskuri; 27 28 Image tahtiKuva = LoadImage("tahti"); 17 29 Image pelaajanKuva = LoadImage("norsu"); 18 Image tahtiKuva = LoadImage("tahti"); 19 20 30 31 Manuli mauno; 21 32 22 33 SoundEffect maaliAani = LoadSoundEffect("maali"); … … 29 40 LisaaNappaimet(); 30 41 LuoPistelaskuri(); 31 Camera.Follow( pelaaja1);42 Camera.Follow(mauno); 32 43 Camera.ZoomFactor = 1.2; 33 44 Camera.StayInLevel = true; … … 36 47 void LuoKentta() 37 48 { 38 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("mystinenmanulikenttä 4");49 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("mystinenmanulikenttä5"); 39 50 ruudut.SetTileMethod(Color.FromHexCode("B200FF"), LisaaPelaaja); 40 ruudut.SetTileMethod(Color.Black, LisaaTaso); 51 ruudut.SetTileMethod(Color.Black, LisaaTaso,Color.Black); 52 ruudut.SetTileMethod(Color.FromHexCode("808080"), LisaaTaso,Color.DarkGray); 41 53 42 54 ruudut.SetTileMethod(Color.FromHexCode("FFD800"),Luoaine,Color.FromHexCode("FFD800"), "juustoh"); … … 69 81 } 70 82 71 void LisaaTaso(Vector paikka, double leveys, double korkeus) 83 void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 84 { 85 mauno = new Manuli(leveys, korkeus); 86 mauno.Image = pelaajanKuva; 87 mauno.Position = paikka; 88 Add(mauno); 89 90 juusto = new IntMeter(0, 0, 2); 91 tomaatti = new IntMeter(0,0,2); 92 leipä = new IntMeter(0,0,2); 93 voi = new IntMeter(0,0,2); 94 kala = new IntMeter(0,0,2); 95 salaatti = new IntMeter(0,0,2); 96 } 97 98 void LisaaTaso(Vector paikka, double leveys, double korkeus, Color vari) 72 99 { 73 100 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 74 101 taso.Position = paikka; 75 taso.Color = Color.Black;102 taso.Color = vari; 76 103 Add(taso); 77 104 } 78 105 79 106 80 void LisaaPelaaja(Vector paikka, double leveys, double korkeus)81 {82 pelaaja1 = new PlatformCharacter(leveys, korkeus);83 pelaaja1.Position = paikka;84 pelaaja1.Tag = "pelaaja";85 pelaaja1.Mass = 4.0;86 pelaaja1.Image = pelaajanKuva;87 Add(pelaaja1);88 107 89 108 90 109 91 }110 92 111 93 112 … … 110 129 aine.Destroy(); 111 130 112 if (aine.Tag.ToString().StartsWith("juusto")) 113 { 114 115 annapisteet(aine); 116 117 } 118 119 if (aine.Tag.ToString().StartsWith("tomaatti")) 120 { 121 122 annapisteet(aine); 123 124 } 125 126 127 if (aine.Tag.ToString().StartsWith("leipä")) 128 { 129 130 annapisteet(aine); 131 132 } 133 134 if (aine.Tag.ToString().StartsWith("salaatti")) 135 { 136 137 annapisteet(aine); 138 139 } 140 141 142 if (aine.Tag.ToString().StartsWith("kala")) 143 { 144 145 annapisteet(aine); 146 147 } 148 149 if (aine.Tag.ToString().StartsWith("voi")) 131 if (aine.Tag.ToString().StartsWith("juusto")&& juusto.Value < juusto.MaxValue) 132 { 133 annapisteet(aine); 134 juusto.Value += 1; 135 } 136 137 if (aine.Tag.ToString().StartsWith("tomaatti")&& tomaatti.Value < tomaatti.MaxValue) 138 { 139 140 annapisteet(aine); 141 142 } 143 144 145 if (aine.Tag.ToString().StartsWith("leipä") && leipä.Value < leipä.MaxValue) 146 { 147 148 annapisteet(aine); 149 150 } 151 152 if (aine.Tag.ToString().StartsWith("salaatti") && salaatti.Value < salaatti.MaxValue) 153 { 154 155 annapisteet(aine); 156 157 } 158 159 160 if (aine.Tag.ToString().StartsWith("kala") && kala.Value < kala.MaxValue) 161 { 162 163 annapisteet(aine); 164 165 } 166 167 if (aine.Tag.ToString().StartsWith("voi") && voi.Value < voi.MaxValue) 150 168 { 151 169 … … 175 193 } 176 194 177 195 178 196 179 197 void LuoPistelaskuri() … … 198 216 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 199 217 200 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus);201 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus);202 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus);218 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", mauno, -nopeus); 219 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", mauno, nopeus); 220 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", mauno, hyppyNopeus); 203 221 204 222 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); 205 223 206 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", pelaaja1, -nopeus);207 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", pelaaja1, nopeus);208 ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus);224 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Liikuta, "Pelaaja liikkuu vasemmalle", mauno, -nopeus); 225 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Liikuta, "Pelaaja liikkuu oikealle", mauno, nopeus); 226 ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", mauno, hyppyNopeus); 209 227 210 228 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); … … 222 240 223 241 224 225 242 } 243 244 245 class Manuli : PlatformCharacter 246 { 247 248 private IntMeter elamaLaskuri = new IntMeter(3, 0, 3); 249 public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 250 251 252 253 public Manuli(double leveys, double korkeus) 254 : base(leveys, korkeus) 255 { 256 257 Tag = "pelaaja"; 258 Mass = 4.0; 259 260 elamaLaskuri.LowerLimit += delegate { this.Destroy(); }; 261 } 262 263 264 265 } -
2016/26/SallaK/Sandwich/Sandwich/Sandwich/Sandwich.csproj.Debug.cachefile
r7580 r7604 7 7 Content\mystinenmanulikenttÀ3.xnb 8 8 Content\mystinenmanulikenttÀ4.xnb 9 Content\mystinenmanulikenttÀ5.xnb -
2016/26/SallaK/Sandwich/Sandwich/Sandwich/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r7580 r7604 74 74 <Time>2016-06-29T13:58:49.6098021+03:00</Time> 75 75 </Item> 76 <Item> 77 <Source>mystinenmanulikenttä5.png</Source> 78 <Name>mystinenmanulikenttä5</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 <Options>None</Options> 82 <Output>C:\MyTemp\SallaK\Sandwich\Sandwich\Sandwich\bin\x86\Debug\Content\mystinenmanulikenttä5.xnb</Output> 83 <Time>2016-06-30T14:25:54.5829364+03:00</Time> 84 </Item> 76 85 <BuildSuccessful>true</BuildSuccessful> 77 86 <Settings> -
2016/26/SallaK/Sandwich/Sandwich/Sandwich/obj/x86/Debug/Sandwich.csproj.FileListAbsolute.txt
r7580 r7604 15 15 C:\MyTemp\SallaK\Sandwich\Sandwich\Sandwich\bin\x86\Debug\Content\mystinenmanulikenttÀ3.xnb 16 16 C:\MyTemp\SallaK\Sandwich\Sandwich\Sandwich\bin\x86\Debug\Content\mystinenmanulikenttÀ4.xnb 17 C:\MyTemp\SallaK\Sandwich\Sandwich\Sandwich\bin\x86\Debug\Content\mystinenmanulikenttÀ5.xnb -
2016/26/SallaK/Sandwich/Sandwich/Sandwich/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r7580 r7604 7 7 Content\mystinenmanulikenttÀ3.xnb 8 8 Content\mystinenmanulikenttÀ4.xnb 9 Content\mystinenmanulikenttÀ5.xnb -
2016/26/SallaK/Sandwich/Sandwich/SandwichContent/SandwichContent.contentproj
r7580 r7604 95 95 </Compile> 96 96 </ItemGroup> 97 <ItemGroup> 98 <Compile Include="mystinenmanulikenttä5.png"> 99 <Name>mystinenmanulikenttä5</Name> 100 <Importer>TextureImporter</Importer> 101 <Processor>TextureProcessor</Processor> 102 </Compile> 103 </ItemGroup> 97 104 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 98 105 <!-- 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.