- Timestamp:
- 2011-06-09 22:08:45 (12 years ago)
- Location:
- 2011/23/hejumunt/RunRunRun/RunRunRun
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/23/hejumunt/RunRunRun/RunRunRun/RunRunRun/Peli.cs
r1814 r1840 28 28 Image kodinKuva = LoadImage("koti"); 29 29 Image taustaKuva = LoadImage("tausta1"); 30 Image autonKuva = LoadImage("auto"); 31 Image tasonKuva = LoadImage("pikkutaso"); 30 32 Shape hahmonMuoto; 31 33 … … 36 38 Timer ajastin = new Timer(); 37 39 int kenttäNro = 1; 38 int kenttäMäärä = 2;40 int kenttäMäärä = 3; 39 41 40 42 List<Label> valikonKohdat; … … 54 56 ajastin.Stop(); 55 57 56 // Miksi taustakuva ei näy kun pelistä tullaan pois escillä??57 58 Level.Width = Screen.Width; 58 59 Level.Height = Screen.Height; … … 60 61 Camera.Reset(); 61 62 62 //Level.Background.Size = new Vector(Screen.Width, Screen.Height); 63 Level.Background.Image = taustaKuva; 64 //Level.Background.Size = new Vector(Screen.Width, Screen.Height); 65 //Level.Background.FitToLevel(); 63 Level.Background.Image = taustaKuva; 66 64 Level.Background.Width = Screen.Width; 67 65 Level.Background.Height = Screen.Height; … … 114 112 elämät--; 115 113 if (elämät > 0) { Uudestaan(); } 116 else 117 { 118 gameover(); 119 } 120 121 122 } 123 114 else { gameover(); } 115 } 124 116 } 125 117 void Lopeta() … … 142 134 Valikko(); // Taustakuva ei näy? ks. r53 143 135 } 136 137 // Menettää elämän ja kenttä käynnistyy alusta 144 138 void Uudestaan() 145 139 { … … 173 167 kentta['E'] = lisaaKello; 174 168 kentta['M'] = lisaaKoti; 169 kentta['A'] = lisaaAuto; 170 kentta['-'] = lisaapikkuTaso; 175 171 kentta.Insert(40.0, 40.0); 176 172 … … 182 178 183 179 Add(hahmo); 184 185 //PhysicsObject alaReuna = Level.CreateBottomBorder(1.0, true);186 180 Gravity = new Vector(0.0, -800.0); 187 //Level.CreateBorders();188 181 Camera.Follow(hahmo); 189 182 Camera.StayInLevel = true; 190 //Timer ajastin = new Timer();191 //ajastin.Interval = 0.01;192 //ajastin.Trigger += liikutaHahmoa193 //ajastin.Start();194 183 } 195 184 void kasittelehahmontormays(PhysicsObject hahmo, PhysicsObject kohde) … … 212 201 kenttäNro++; 213 202 ClearAll(); 203 ajastin.Stop(); 214 204 if (kenttäNro > kenttäMäärä) 215 205 { … … 225 215 Keyboard.Listen(Key.Enter, ButtonState.Pressed, SeuraavaKentta, null); 226 216 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Palaaminen, null); 227 // voittoteksti228 // 3 sekunnin paasta SeuraavaKentta();229 // Timer.SingleShot...230 217 } 231 218 } … … 250 237 alaspainLaskuri = new DoubleMeter(15); 251 238 239 LuoAjastin(); 240 241 Label aikaNaytto = new Label(); 242 aikaNaytto.TextColor = Color.Black; 243 aikaNaytto.BindTo(alaspainLaskuri); 244 Add(aikaNaytto); 245 246 Mouse.IsCursorVisible = false; 247 248 } 249 void LuoAjastin() 250 { 252 251 ajastin = new Timer(); 253 252 ajastin.Interval = 0.1; 254 253 ajastin.Trigger += aikaloppui; 255 254 ajastin.Start(); 256 257 Label aikaNaytto = new Label(); 258 aikaNaytto.TextColor = Color.Black; 259 aikaNaytto.BindTo(alaspainLaskuri); 260 Add(aikaNaytto); 261 262 Mouse.IsCursorVisible = false; 263 255 } 256 PhysicsObject lisaapikkuTaso() 257 { 258 PhysicsObject pikkuTaso = PhysicsObject.CreateStaticObject(50, 20); 259 pikkuTaso.Image = tasonKuva; 260 return pikkuTaso; 261 } 262 PhysicsObject lisaaAuto() 263 { 264 PhysicsObject auto = PhysicsObject.CreateStaticObject(200, 80); 265 auto.Image = autonKuva; 266 return auto; 264 267 } 265 268 … … 368 371 elämät = 3; 369 372 alaspainLaskuri = new DoubleMeter(15); 370 371 373 ajastin = new Timer(); 374 372 375 ajastin.Interval = 0.1; 373 376 ajastin.Trigger += aikaloppui; … … 407 410 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 408 411 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Valikko, "Poistu valikkoon"); 409 412 Keyboard.Listen(Key.Insert, ButtonState.Pressed, kenttaloppui, null); 413 Keyboard.Listen(Key.End, ButtonState.Pressed, cheat, null); 414 Keyboard.Listen(Key.NumPad7, ButtonState.Pressed, cheat1, null); 415 416 } 417 void cheat() 418 { 419 ajastin.Stop(); 420 } 421 void cheat1() 422 { 423 ajastin.Start(); 410 424 } 411 425 void AsetaNopeus(Vector vektori) -
2011/23/hejumunt/RunRunRun/RunRunRun/RunRunRun/RunRunRun.csproj
r1814 r1840 125 125 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 126 126 </Content> 127 <Content Include="kentta3.txt"> 128 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 129 </Content> 127 130 </ItemGroup> 128 131 <ItemGroup> -
2011/23/hejumunt/RunRunRun/RunRunRun/RunRunRunContent/RunRunRunContent.contentproj
r1814 r1840 182 182 </Compile> 183 183 </ItemGroup> 184 <ItemGroup> 185 <Compile Include="Auto.png"> 186 <Name>Auto</Name> 187 <Importer>TextureImporter</Importer> 188 <Processor>TextureProcessor</Processor> 189 </Compile> 190 </ItemGroup> 191 <ItemGroup> 192 <Compile Include="pikkutaso.png"> 193 <Name>pikkutaso</Name> 194 <Importer>TextureImporter</Importer> 195 <Processor>TextureProcessor</Processor> 196 </Compile> 197 </ItemGroup> 184 198 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 185 199 <!-- 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.