Changeset 668
- Timestamp:
- 2010-06-10 11:43:04 (11 years ago)
- Location:
- 2010/23/tajomyll/EHGABWWTGSBIAE
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/tajomyll/EHGABWWTGSBIAE/EHGABWWTGSBIAE.csproj
r644 r668 89 89 <Content Include="Game.ico" /> 90 90 <Content Include="GameThumbnail.png" /> 91 <Content Include="kentta1.txt"> 92 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 93 </Content> 91 94 </ItemGroup> 92 95 <ItemGroup> -
2010/23/tajomyll/EHGABWWTGSBIAE/Peli.cs
r644 r668 3 3 using Jypeli.ScreenObjects; 4 4 using Jypeli.Assets; 5 using System.Collections.Generic; 5 6 6 7 … … 9 10 class Tasohyppely : PhysicsGame 10 11 { 12 const int ruudunLeveys = 40; 13 const int ruudunKorkeus = 32; 14 11 15 const double nopeus = 200; 12 16 const double hyppyVoima = 3500; … … 18 22 19 23 int kenttaNro; // monesko kenttä on menossa 24 20 25 21 26 // int MikaHuone = 0; … … 25 30 { 26 31 kenttaNro = 0; 27 Level.Width = 2000;28 Level.Height = 10 00;32 Level.Width = 1240; 33 Level.Height = 1024; 29 34 30 35 // Luodaan pistelaskuri … … 47 52 void seuraavaKentta() 48 53 { 49 ClearAll(); 50 pisteLaskuri.Reset(); 51 52 kenttaNro += 1; // lisätään kenttänumeroa yhdellä 53 MessageDisplay.Add("Kenttä " + kenttaNro); 54 55 // if (kenttaNro == 0) 56 // { 57 Level.Background.Image = LoadImage("Koti"); 58 // } 59 54 // ClearAll(); 55 // pisteLaskuri.Reset(); 56 57 // kenttaNro += 1; lisätään kenttänumeroa yhdellä 58 // MessageDisplay.Add("Kenttä " + kenttaNro); 59 60 /* if (kenttaNro == 0) 61 { 62 LuoKoti(); 63 //Level.Background.Image = LoadImage("Koti"); 64 } 65 else if (kenttaNro == 1) 66 { 67 LuoKallio(); 68 } 69 */ 60 70 // Asetetaan painovoima 61 71 Gravity = new Vector(0, -1000); … … 67 77 void luoKentta() 68 78 { 69 // if (MikaHuone == 1) 70 // { 71 // Level.Background = LoadImage("Koti"); 72 // } 73 // else if (MikaHuone == 2) 74 // { 75 // Level.Background = LoadImage("Kallio"); 76 // } 77 // else if (MikaHuone == 3) 78 // { 79 // Level.Background = LoadImage("Kauppa"); 80 // } 81 Level.CreateBorders(); 82 Level.Background.Size = new Vector(1240,1024); 83 84 lisaaTaso(-500.0, -500.0, 300.0, 1350.0); 85 lisaaTaso(-100.0,-100.0, 170.0, 100.0); 86 lisaaTaso(210.0, 30.0,105.0, 25.0); 87 lisaaTaso(475.0, -200.0, 125.0, 700.0); 88 lisaaTaso(-300.0, -500.0, 325.0, 600.0); 89 lisaaTaso(500.0, -200.0, 125.0, 800.0); 90 lisaaPiikit(200.0, -500.0, 700.0, 100.0); 91 lisaaPiikit(-300.0, -200.0, 200.0, 100.0); 92 lisaaPiikit(-200.0, 505.0, 275.0, 275.0); 93 // lisaaTaso(0, -200); 94 95 // lisaaMaali(); 96 lisaaPelaajat(); 97 } 98 99 void lisaaTaso(double x, double y, double leveys, double korkeus) 100 { 101 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 79 if (kenttaNro == 0) 80 { 81 // Level.Background.Image = LoadImage("Koti"); 82 LuoKoti(); 83 } 84 /*else if (kenttaNro == 1) 85 { 86 Level.Background = LoadImage("Kallio"); 87 } 88 else if (kenttaNro == 2) 89 { 90 Level.Background = LoadImage("Kauppa"); 91 }*/ 92 93 } 94 95 PhysicsObject lisaaTaso() 96 { 97 MessageDisplay.Add("Tultiin lisaaTaso()-aliohjelmaan"); 98 PhysicsObject taso = PhysicsObject.CreateStaticObject(ruudunLeveys, ruudunKorkeus); 99 taso.Color = Color.Green; 102 100 taso.IsVisible = false; 103 taso.X = x; 104 taso.Y = y; 105 Add(taso); 106 } 107 void lisaaPiikit(double x, double y, double leveys, double korkeus) 108 { 109 PhysicsObject piikit = PhysicsObject.CreateStaticObject(leveys, korkeus); 101 //taso.X = x; 102 //taso.Y = y; 103 //Add(taso); 104 return taso; 105 } 106 PhysicsObject lisaaPiikit() 107 { 108 PhysicsObject piikit = PhysicsObject.CreateStaticObject(ruudunLeveys, ruudunKorkeus); 109 piikit.Color = Color.Blue; 110 110 piikit.IsVisible = false; 111 piikit.X = x;112 piikit.Y = y;111 //piikit.X = x; 112 //piikit.Y = y; 113 113 AddCollisionHandler(piikit, KasittelePiikkienTormays); 114 Add(piikit); 115 } 116 117 void lisaaPelaajat() 114 //Add(piikit); 115 return piikit; 116 } 117 PhysicsObject lisaaReuna() 118 { 119 PhysicsObject reuna = PhysicsObject.CreateStaticObject(40, 32); 120 reuna.Shape = Shapes.Rectangle; 121 reuna.IsVisible = false; 122 return reuna; 123 } 124 125 PhysicsObject lisaaPelaaja() 118 126 { 119 127 pelaaja1 = new PlatformCharacter(28, 48); … … 129 137 pelaaja1.RightIdleAnimation = new Animation(Image.Mirror(LoadImage("Pelihahmo1"))); 130 138 // pelaaja1.Image = LoadImage("Pelihahmo1"); 131 pelaaja1.X = -500;132 pelaaja1.Y = Level.Bottom + 1000;139 //pelaaja1.X = -500; 140 //pelaaja1.Y = Level.Bottom + 710; 133 141 134 142 // AddCollisionHandler(pelaaja1, KasittelePiikkienTormays); 135 143 //AddCollisionHandler(pelaaja1, osuiMaaliin); 136 144 137 Add(pelaaja1); 145 //Add(pelaaja1); 146 return pelaaja1; 138 147 } 139 148 … … 197 206 pelaaja1.Y = Level.Bottom + 1000; 198 207 } 199 208 /*void KasittelePelaajanTormays(PhysicsObject pelaaja1, PhysicsObject kohde) 209 { 210 if (kohde == oikeareuna) 211 { 212 kenttaNro = kenttaNro + 1; 213 } 214 }*/ 215 216 void LuoKoti() 217 { 218 //Level.Background = new Background(new Vector(1240, 1024)).Image = LoadImage("Koti"); 219 //Background tausta = new Background(new Vector(1240, 1024)); 220 //tausta.Image = LoadImage("Koti"); 221 //Add(tausta); 222 MessageDisplay.Add("Tultiin LuoKoti()-aliohjelmaan"); 223 Level.CreateBorders(); 224 225 Level.Background.Image = LoadImage("Koti"); 226 Level.Background.Size = new Vector(1240, 1024); 227 228 //lisaaTaso(-500.0, -500.0, 300.0, 1350.0); 229 //lisaaTaso(-100.0, -100.0, 170.0, 100.0); 230 //lisaaTaso(210.0, 30.0, 105.0, 25.0); 231 //lisaaTaso(475.0, -200.0, 125.0, 700.0); 232 //lisaaTaso(-300.0, -500.0, 325.0, 600.0); 233 //lisaaTaso(550.0, -125.0, 125.0, 800.0); 234 //lisaaPiikit(200.0, -500.0, 700.0, 100.0); 235 //lisaaPiikit(-275.0, -200.0, 250.0, 100.0); 236 //lisaaPiikit(-200.0, 505.0, 275.0, 275.0); 237 // AddCollisionHandler(pelaaja1, KasittelePelaajanTormays); 238 // lisaaTaso(0, -200); 239 var merkit = new Dictionary<char, ObjectCreator>(); 240 merkit['x'] = lisaaTaso; 241 merkit['i'] = lisaaPiikit; 242 merkit['p'] = lisaaPelaaja; 243 merkit['|'] = lisaaReuna; 244 char[,] ruudut = Tiles.ReadFromFile("kentta1.txt"); 245 Tiles.Insert(this, ruudut, merkit, ruudunLeveys, ruudunKorkeus); 246 247 248 // lisaaMaali(); 249 250 } 251 void LuoKallio() 252 { 253 Level.Background.Image = LoadImage("Kallio"); 254 Level.Background.Size = new Vector(1240, 1024); 255 } 256 void LuoKauppa() 257 { 258 Level.Background.Image = LoadImage("Kauppa"); 259 Level.Background.Size = new Vector(1240, 1024); 260 } 261 200 262 } 201 263 }
Note: See TracChangeset
for help on using the changeset viewer.