- Timestamp:
- 2016-06-16 14:48:43 (7 years ago)
- Location:
- 2016/24/JesseH/Cubes
- Files:
-
- 5 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/24/JesseH/Cubes/Cubes/Cubes/Cubes.cs
r7341 r7378 14 14 15 15 List<Hahmo> pelaajat = new List<Hahmo>(); 16 GameObject maski; 16 17 int aktiivinenPelaaja = 0; 17 18 Image fredKuva = LoadImage("Fred"); … … 22 23 Image VasenKuva = LoadImage("Vasen"); 23 24 Image OikeaKuva = LoadImage("Oikea"); 25 Image maskiKuva = LoadImage("maski"); 24 26 IntMeter pelaajiaMaalissa; 25 27 … … 27 29 28 30 public override void Begin() 31 { 32 ClearAll(); 33 34 MultiSelectWindow alkuValikko = new MultiSelectWindow("Cubes", 35 "Aloitapeli", "PelinOhjeet", "Exit"); 36 Add(alkuValikko); 37 38 alkuValikko.AddItemHandler(0, AloitaPeli); 39 alkuValikko.AddItemHandler(1, PelinOhjeet); 40 alkuValikko.AddItemHandler(2, Exit); 41 Level.Background.CreateGradient(Color.DarkGray, Color.Black); 42 } 43 44 void PelinOhjeet() 45 { 46 ClearAll(); 47 IsMouseVisible = true; 48 Label tekstikentta = new Label("Käytä Toisia Palikoita apuna. Vaihda pelaajaa Alt Näppäimestä"); 49 Add(tekstikentta); 50 GameObject nappula = new GameObject(LoadImage("Nappula")); 51 nappula.Position = new Vector(0, -100); 52 Add(nappula); 53 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Klikkaus, null, nappula); 54 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Begin, "Palaa valikkoon"); 55 56 57 } 58 59 void Klikkaus(GameObject nappula) 60 { 61 if (Mouse.IsCursorOn(nappula)) Begin(); 62 } 63 64 65 void AloitaPeli() 29 66 { 30 67 Gravity = new Vector(0, -1000); … … 37 74 Camera.StayInLevel = true; 38 75 } 39 40 76 void LuoKentta() 41 77 { … … 50 86 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 51 87 Level.CreateBorders(); 52 Level.Background.CreateGradient(Color.LightGray, Color.Gray); 88 Level.Background.CreateGradient( Color.DarkGray, Color.Black); 89 90 91 maski = new GameObject(1600, 1600); 92 maski.Image = this.maskiKuva; 93 pelaajat[aktiivinenPelaaja].Add(maski); 94 53 95 } 54 96 … … 87 129 pelaaja.Image = kuva; 88 130 pelaaja.Tag = nimi; 89 AddCollisionHandler(pelaaja, "Ovi", Tormaa Tahteen);131 AddCollisionHandler(pelaaja, "Ovi", TormaaMaaliin); 90 132 AddCollisionHandler(pelaaja, "Avain", TormaaAvaimeen); 91 133 Add(pelaaja); 92 134 pelaajat.Add(pelaaja); 93 135 pelaaja.Hyppynopeus = hyppyNopeus; 136 94 137 } 95 138 … … 127 170 void VaihdaPelaajaa() 128 171 { 172 pelaajat[aktiivinenPelaaja].Remove(maski); 129 173 aktiivinenPelaaja++; 130 174 if (aktiivinenPelaaja > pelaajat.Count - 1) … … 133 177 } 134 178 Camera.Follow(pelaajat[aktiivinenPelaaja]); 179 180 pelaajat[aktiivinenPelaaja].Add(maski); 135 181 } 136 182 void Liikuta(double nopeus) … … 144 190 } 145 191 146 void TormaaTahteen(PhysicsObject hahmo, PhysicsObject tahti) 147 { 148 192 void TormaaMaaliin(PhysicsObject hahmo, PhysicsObject tahti) 193 { 194 if (pelaajat[aktiivinenPelaaja].Equals(hahmo)) 195 { 196 pelaajat.Remove(pelaajat[aktiivinenPelaaja]); 197 VaihdaPelaajaa(); 198 } 199 else 200 { 201 for (int i = 0; i < pelaajat.Count-1; i++) 202 { 203 if (pelaajat[i].Equals(hahmo)) pelaajat.Remove(pelaajat[i]); 204 } 205 } 149 206 hahmo.Destroy(); 150 207 pelaajiaMaalissa.Value++; -
2016/24/JesseH/Cubes/Cubes/Cubes/Cubes.csproj.Debug.cachefile
r7341 r7378 8 8 Content\Oikea.xnb 9 9 Content\avain.xnb 10 Content\Nappula.xnb 11 Content\maski.xnb -
2016/24/JesseH/Cubes/Cubes/Cubes/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml
r7341 r7378 83 83 <Time>2016-06-15T10:28:43.0060156+03:00</Time> 84 84 </Item> 85 <Item> 86 <Source>Nappula.png</Source> 87 <Name>Nappula</Name> 88 <Importer>TextureImporter</Importer> 89 <Processor>TextureProcessor</Processor> 90 <Options>None</Options> 91 <Output>C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\Nappula.xnb</Output> 92 <Time>2016-06-16T10:48:03.5433101+03:00</Time> 93 </Item> 94 <Item> 95 <Source>maski.png</Source> 96 <Name>maski</Name> 97 <Importer>TextureImporter</Importer> 98 <Processor>TextureProcessor</Processor> 99 <Options>None</Options> 100 <Output>C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\maski.xnb</Output> 101 <Time>2016-06-16T11:15:36.0162101+03:00</Time> 102 </Item> 85 103 <BuildSuccessful>true</BuildSuccessful> 86 104 <Settings> -
2016/24/JesseH/Cubes/Cubes/Cubes/obj/x86/Debug/Cubes.csproj.FileListAbsolute.txt
r7341 r7378 16 16 C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\Oikea.xnb 17 17 C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\avain.xnb 18 C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\Nappula.xnb 19 C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\maski.xnb -
2016/24/JesseH/Cubes/Cubes/Cubes/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt
r7341 r7378 8 8 Content\Oikea.xnb 9 9 Content\avain.xnb 10 Content\Nappula.xnb 11 Content\maski.xnb -
2016/24/JesseH/Cubes/Cubes/CubesContent/CubesContent.contentproj
r7341 r7378 113 113 </Compile> 114 114 </ItemGroup> 115 <ItemGroup> 116 <Compile Include="Nappula.png"> 117 <Name>Nappula</Name> 118 <Importer>TextureImporter</Importer> 119 <Processor>TextureProcessor</Processor> 120 </Compile> 121 </ItemGroup> 122 <ItemGroup> 123 <Compile Include="maski.png"> 124 <Name>maski</Name> 125 <Importer>TextureImporter</Importer> 126 <Processor>TextureProcessor</Processor> 127 </Compile> 128 </ItemGroup> 115 129 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 116 130 <!-- 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.