- Timestamp:
- 2010-06-10 11:46:48 (13 years ago)
- Location:
- 2010/23/teematma/Tasohyppely2
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/teematma/Tasohyppely2/Content/Content.contentproj
r645 r673 68 68 </Compile> 69 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="taso.png"> 72 <Name>taso</Name> 73 <Importer>TextureImporter</Importer> 74 <Processor>TextureProcessor</Processor> 75 </Compile> 76 </ItemGroup> 70 77 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 71 78 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/23/teematma/Tasohyppely2/Peli.cs
r645 r673 3 3 using Jypeli.ScreenObjects; 4 4 using Jypeli.Assets; 5 using System.Collections.Generic; 5 6 6 7 … … 12 13 const double hyppyVoima = 2000; 13 14 15 const int ruudunLeveys = 50; 16 const int ruudunKorkeus = 50; 17 18 14 19 IntMeter pisteLaskuri; 15 20 ValueDisplay pisteNaytto; … … 25 30 { 26 31 kenttaNro = 0; 27 Level.Width = 9000;28 Level.Height = 10 00;32 Level.Width = 1800; 33 Level.Height = 1050; 29 34 30 35 // Luodaan pistelaskuri … … 41 46 // Zoomataan lähemmäksi 42 47 Camera.ZoomFactor = 2.0; 43 44 Camera.StayInLevel = true;48 //Camera.ZoomToLevel(); 49 //Camera.StayInLevel = false; 45 50 46 51 seuraavaKentta(); … … 68 73 void luoKentta() 69 74 { 70 Level.CreateBorders(); 71 Level.Background.CreateGradient( Color.LightYellow, Color.DarkMagenta ); 72 75 Level.CreateBorders(1.0, false); 76 Level.Background.CreateGradient( Color.Lime, Color.DarkMagenta ); 77 78 var merkit = new Dictionary<char, ObjectCreator>(); 79 merkit['X'] = lisaaTaso; 80 merkit['M'] = lisaaMaali; 81 merkit['P'] = lisaaPelaajat; 82 83 char[,] ruudut = Tiles.ReadFromFile("kentta.txt"); 84 Tiles.Insert(this, ruudut, merkit, 50, 50); 85 86 /* 73 87 lisaaTaso(-4200, -500); 74 88 lisaaTaso(-4100, -400); … … 85 99 lisaaTaso(-4500, -500); 86 100 lisaaTaso(-4400, -500); 87 88 for (int i = 0; i < 10 00; i++)101 */ 102 for (int i = 0; i < 10; i++) 89 103 { 90 104 lisaaPallo(); 91 105 } 92 106 lisaaMaali(); 93 lisaaPelaajat(); 94 } 95 96 void lisaaTaso( double x, double y ) 97 { 98 PhysicsObject taso = PhysicsObject.CreateStaticObject( 100, 50 ); 99 taso.Color = Color.DarkCyan; 107 } 108 109 PhysicsObject lisaaTaso() 110 { 111 PhysicsObject taso = PhysicsObject.CreateStaticObject( 50, 50 ); 112 taso.Image = LoadImage("taso"); 100 113 taso.LinearDamping = 1; 101 114 taso.Tag = "taso"; 102 taso.X = x; 103 taso.Y = y; 104 Add( taso ); 115 return taso; 116 105 117 } 106 118 … … 118 130 } 119 131 120 void lisaaPelaajat() 121 { 122 //pelaaja1 = new PlatformCharacter( 40, 40 ); 132 PhysicsObject lisaaPelaajat() 133 { 123 134 pelaaja1 = new PhysicsObject(40, 40, Shapes.Circle); 124 135 pelaaja1.Mass = 2.0; … … 127 138 pelaaja1.KineticFriction = 1; 128 139 pelaaja1.LinearDamping = 0.95; 129 130 pelaaja1.X = Level.Left + 120; 131 pelaaja1.Y = Level.Bottom + 120; 140 pelaaja1.Restitution = 0.4; 132 141 133 142 AddCollisionHandler( pelaaja1, osuiMaaliin ); 134 AddCollisionHandler( pelaaja1, lisaaHyppy);143 AddCollisionHandler( pelaaja1, lisaaHyppy); 135 144 136 Add( pelaaja1 );137 } 138 139 voidlisaaMaali()145 return pelaaja1; 146 } 147 148 PhysicsObject lisaaMaali() 140 149 { 141 150 PhysicsObject maali = PhysicsObject.CreateStaticObject( 50, 50, Shapes.Circle ); 142 151 maali.Tag = "maali"; 143 152 maali.IgnoresCollisionResponse = true; 144 maali.X = 30;145 maali.Y = -60;146 153 maali.Image = LoadImage( "tahti" ); 147 Add( maali );154 return maali; 148 155 } 149 156 … … 172 179 void liikuta( PhysicsObject hahmo, Vector nopeus ) 173 180 { 174 //hahmo.Walk( nopeus ); Kokeile liikuttamiseen .Push-metodia181 //hahmo.Walk( nopeus ); //Kokeile liikuttamiseen .Push-metodia 175 182 hahmo.Push(nopeus); 176 183 } -
2010/23/teematma/Tasohyppely2/Tasohyppely2.csproj
r565 r673 89 89 <Content Include="Game.ico" /> 90 90 <Content Include="GameThumbnail.png" /> 91 <Content Include="kentta.txt"> 92 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 93 </Content> 91 94 </ItemGroup> 92 95 <ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.