Changeset 645 for 2010/23/teematma/Tasohyppely2
- Timestamp:
- 2010-06-09 15:02:40 (11 years ago)
- Location:
- 2010/23/teematma/Tasohyppely2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/teematma/Tasohyppely2/Content/Content.contentproj
r612 r645 61 61 </Compile> 62 62 </ItemGroup> 63 <ItemGroup> 64 <Compile Include="Untitled.png"> 65 <Name>Untitled</Name> 66 <Importer>TextureImporter</Importer> 67 <Processor>TextureProcessor</Processor> 68 </Compile> 69 </ItemGroup> 63 70 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 64 71 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/23/teematma/Tasohyppely2/Peli.cs
r612 r645 69 69 { 70 70 Level.CreateBorders(); 71 //Level.Background.CreateGradient( Color.Red, Color.DarkMagenta ); 72 73 lisaaTaso( -4200, -500 ); 74 lisaaTaso( -4100, -400 ); 75 lisaaTaso( -3900, -350 ); 76 lisaaTaso( -3700, -250 ); 77 lisaaTaso( -4500, -500 ); 78 lisaaTaso( -4400, -500 ); 79 80 81 lisaaTaso(-3700, -300 ); 82 lisaaTaso(-3700, -400 ); 83 lisaaTaso(-3700, -350 ); 84 lisaaTaso(-3700, -250 ); 85 lisaaTaso(-4500, -500 ); 86 lisaaTaso(-4400, -500 ); 87 88 lisaaPallo(-4495, -460); 89 71 Level.Background.CreateGradient( Color.LightYellow, Color.DarkMagenta ); 72 73 lisaaTaso(-4200, -500); 74 lisaaTaso(-4100, -400); 75 lisaaTaso(-3900, -350); 76 lisaaTaso(-3700, -250); 77 lisaaTaso(-4500, -500); 78 lisaaTaso(-4400, -500); 79 80 81 lisaaTaso(-3700, -300); 82 lisaaTaso(-3700, -400); 83 lisaaTaso(-3700, -350); 84 lisaaTaso(-3700, -250); 85 lisaaTaso(-4500, -500); 86 lisaaTaso(-4400, -500); 87 88 for (int i = 0; i < 1000; i++) 89 { 90 lisaaPallo(); 91 } 90 92 lisaaMaali(); 91 93 lisaaPelaajat(); … … 95 97 { 96 98 PhysicsObject taso = PhysicsObject.CreateStaticObject( 100, 50 ); 97 taso.Color = Color. Orange;99 taso.Color = Color.DarkCyan; 98 100 taso.LinearDamping = 1; 99 101 taso.Tag = "taso"; … … 102 104 Add( taso ); 103 105 } 104 void lisaaPallo(double x, double y) 106 107 void lisaaPallo() 105 108 { 106 109 PhysicsObject pallo = PhysicsObject.CreateStaticObject(25, 25); 107 110 pallo.Shape = Shapes.Circle; 108 pallo. Color = Color.Orange;111 pallo.Image = LoadImage("Untitled"); 109 112 pallo.LinearDamping = 1; 110 113 pallo.IgnoresCollisionResponse = true; 111 114 pallo.Tag = "pallo"; 112 pallo.X = x;113 pallo.Y = y;115 pallo.X = RandomGen.NextDouble(Level.Left + 60, Level.Right -60); 116 pallo.Y = RandomGen.NextDouble(Level.Top -20, Level.Bottom +20); 114 117 Add(pallo); 115 118 } … … 121 124 pelaaja1.Mass = 2.0; 122 125 123 pelaaja1.Image = LoadImage( " kuu" );126 pelaaja1.Image = LoadImage( "Untitled" ); 124 127 pelaaja1.KineticFriction = 1; 125 128 pelaaja1.LinearDamping = 0.95; … … 185 188 186 189 187 void osuiMaaliin( PhysicsObject collidingObject, PhysicsObject otherObject)190 void osuiMaaliin(PhysicsObject collidingObject, PhysicsObject otherObject) 188 191 { 189 192 //MessageDisplay.Add("Levelin bottom: " + Level.Bottom); 190 193 //MessageDisplay.Add(pelaaja1.Position.Y.ToString()); 191 if ( otherObject.Tag.ToString() == "maali")192 { 193 this.PlaySound( "maali");194 if (otherObject.Tag.ToString() == "maali") 195 { 196 this.PlaySound("maali"); 194 197 int edellisenKentanPisteet = pisteLaskuri.Value; 195 198 seuraavaKentta(); 196 MessageDisplay.Add( "Pääsit läpi kentän " + kenttaNro + ". Pisteitä: " + edellisenKentanPisteet ); 197 } 198 199 if (collidingObject.Y < Level.Bottom + 20) 200 { 201 MessageDisplay.Add("Kuolit! Paina Enter yrittääksesi uudestaan"); 199 MessageDisplay.Add("Pääsit läpi kentän " + kenttaNro + ". Pisteitä: " + edellisenKentanPisteet); 200 } 201 202 if (otherObject.Tag.ToString() == "pallo") 203 { 202 204 Explosion e = new Explosion(500); 203 205 e.Speed = 500.0; … … 206 208 207 209 e.Position = pelaaja1.Position; 210 otherObject.Destroy(); 211 Add(e); 212 } 213 214 if (collidingObject.Y < Level.Bottom + 20) 215 { 216 MessageDisplay.Add("Kuolit! Paina Enter yrittääksesi uudestaan"); 217 Explosion e = new Explosion(1000); 218 e.Speed = 1000.0; 219 e.Force = 10000; 220 221 222 e.Position = pelaaja1.Position; 208 223 collidingObject.Destroy(); 209 224 Add(e); 210 225 } 211 } 226 227 } 228 212 229 213 230 void lisaaHyppy(PhysicsObject collidingObject, PhysicsObject otherObject)
Note: See TracChangeset
for help on using the changeset viewer.