Changeset 967 for 2010/24/joaamaka
- Timestamp:
- 2010-06-18 10:37:34 (11 years ago)
- Location:
- 2010/24/joaamaka/The hole
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/joaamaka/The hole/Content/Content.contentproj
r950 r967 93 93 </Compile> 94 94 </ItemGroup> 95 <ItemGroup> 96 <Compile Include="pisteet.png"> 97 <Name>pisteet</Name> 98 <Importer>TextureImporter</Importer> 99 <Processor>TextureProcessor</Processor> 100 </Compile> 101 </ItemGroup> 95 102 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 96 103 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/24/joaamaka/The hole/Peli.cs
r950 r967 1 1 using System; 2 using System.Collections.Generic; 2 3 using Jypeli; 3 4 using Jypeli.ScreenObjects; … … 17 18 GameObject vaikea = new GameObject(300, 100); 18 19 GameObject loppu = new GameObject(100, 100); 19 20 GameObject pisteet = new GameObject(300, 100); 21 22 List<PhysicsObject> lista; 20 23 PlatformCharacter olio; 21 24 Vector aloituspaikka; … … 40 43 Mouse.IsCursorVisible = true; 41 44 42 seuraavaKentta();45 //seuraavaKentta(); 43 46 MessageDisplay.Add("Hyppää kuiluun!"); 44 47 } … … 52 55 Camera.StayInLevel = true; 53 56 Camera.FollowedObject = null; 57 Camera.ZoomFactor = 1.0; 54 58 55 59 helppo = new GameObject(300, 100); … … 62 66 Mouse.ListenOn(vaikea, MouseButton.Left, ButtonState.Pressed, valitse, "", 2); 63 67 Mouse.ListenOn(loppu, MouseButton.Left, ButtonState.Pressed, Exit, ""); 68 Mouse.ListenOn(pisteet, MouseButton.Left, ButtonState.Pressed, piste, ""); 64 69 65 70 … … 68 73 vaikea.Image = LoadImage("vtaso3"); 69 74 loppu.Image = LoadImage("loppu"); 75 pisteet.Image = LoadImage("pisteet"); 70 76 71 77 helppo.X = 100; … … 75 81 vaikea.X = 100; 76 82 vaikea.Y = -200; 77 loppu.X = - 200;83 loppu.X = -400; 78 84 loppu.Y = 200; 85 pisteet.X = -400; 86 pisteet.Y = 0; 79 87 80 88 Add(helppo); … … 82 90 Add(vaikea); 83 91 Add(loppu); 92 Add(pisteet); 84 93 Level.Background.CreateGradient(Color.Gray, Color.White); 85 94 } … … 106 115 Mouse.Enabled = false; 107 116 seuraavaKentta(); 117 } 118 119 void piste() 120 { 121 ClearAll(); 122 Mouse.Enabled = true; 123 Mouse.IsCursorVisible = true; 124 Camera.Position = new Vector(0, 0); 125 Camera.StayInLevel = true; 126 Camera.FollowedObject = null; 127 Camera.ZoomFactor = 1.0; 128 129 loppu = new GameObject(100, 100); 130 Mouse.ListenOn(loppu, MouseButton.Left, ButtonState.Pressed, Exit, ""); 131 loppu.X = -200; 132 loppu.Y = 200; 133 loppu.Image = LoadImage("loppu"); 134 Add(loppu); 135 Level.Background.CreateGradient(Color.Gray, Color.White); 136 108 137 } 109 138 … … 117 146 lisaaNappaimet(); 118 147 Camera.Follow(olio); 148 119 149 120 150 Timer korkeusAjastin = new Timer(); … … 128 158 { 129 159 Level.Background.CreateGradient(Color.Gray, Color.White); 130 160 lista = new List<PhysicsObject>(); 161 131 162 TileMap ruudut = TileMap.FromFile("TextFile1.txt"); 132 163 ruudut['-'] = lisaaTaso; … … 199 230 PhysicsObject lisaaPiikit() 200 231 { 201 PhysicsObject piikit = new PhysicsObject(100, 30, Shapes.Rectangle);232 PhysicsObject piikit = new PhysicsObject(100, 20, Shapes.Rectangle); 202 233 piikit.Tag = "piikki"; 203 234 piikit.IgnoresGravity = true; 204 235 piikit.IgnoresCollisionResponse = true; 205 piikit.X = 100;206 piikit.Y = 50;236 //piikit.X = 100; 237 //piikit.Y = 50; 207 238 piikit.Image = LoadImage("Spikes"); 208 239 return piikit; … … 230 261 PhysicsObject Arvonta() 231 262 { 263 PhysicsObject listas; 264 232 265 int ruutu= RandomGen.NextInt(1, 3); 233 266 if (ruutu == 1) 234 267 { 235 returnlisaaPiikit();236 } 237 if (ruutu == 2)238 { 239 returnlisaaTaso();268 listas= lisaaPiikit(); 269 } 270 else if (ruutu == 2) 271 { 272 listas= lisaaTaso(); 240 273 } 241 274 else … … 244 277 tyhja.IgnoresCollisionResponse = true; 245 278 tyhja.IsVisible = false; 246 return tyhja; 247 } 248 } 249 279 tyhja.Tag = "tyhja"; 280 listas= tyhja; 281 } 282 lista.Add(listas); 283 tarkistus(); 284 return listas; 285 } 286 287 void tarkistus() 288 { 289 if (lista.Count == 7) 290 { 291 for (int i = 0; i < lista.Count; i++) 292 { 293 if (lista[i].Tag.ToString() == "tyhja") 294 { 295 lista.Clear(); 296 return; 297 } 298 else if (i == 6) 299 { 300 lista[RandomGen.NextInt(0, 6)].Destroy() ; 301 lista.Clear(); 302 } 303 } 304 } 305 else return; 306 } 250 307 251 308 PhysicsObject lisaaNuoli()
Note: See TracChangeset
for help on using the changeset viewer.