Changeset 2381
- Timestamp:
- 2011-06-30 15:00:28 (12 years ago)
- Location:
- 2011/26/JoelH/THPeli
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/26/JoelH/THPeli/THPeli/Peli.cs
r2310 r2381 9 9 public class Peli : PhysicsGame 10 10 { 11 int pMaxMaara = 200; 12 ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("explosio"), 500); 13 14 List<Label> valikonKohdat; 11 15 const double nopeus = 300; 12 const double hyppyNopeus = 900;16 const double hyppyNopeus = 1000; 13 17 const int RUUDUN_KOKO = 40; 14 18 PlatformCharacter pelaaja1; … … 17 21 Image tahtiKuva = LoadImage("tahti"); 18 22 Image piikkikuva = LoadImage("piikit"); 23 Image norsuleft = LoadImage("norsuwalkingleft"); 24 Image norsuIdle = LoadImage("norsuidle"); 25 Image norsuRight = LoadImage("anothernorsu"); 19 26 Image splashscreen = LoadImage("Knife's Edge"); 27 Image exploosio = LoadImage("explosio"); 20 28 21 29 public override void Begin() 22 30 { 23 PhysicsObject splash = new PhysicsObject( 400.0, 400.0 ); 24 splash.Shape = Shape.Rectangle; 25 splash.Image = splashscreen; 26 31 Valikko(); 32 ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("explosio"), 50); 33 27 34 MediaPlayer.Play("Game Theme"); 28 35 MediaPlayer.IsRepeating = true; 36 } 37 38 private void alotapeli() 39 { 40 ClearAll(); 41 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Valikko, "Palaa valikkoon"); 42 29 43 Gravity = new Vector(0, -800); 30 44 … … 35 49 Camera.ZoomFactor = 3.0; 36 50 Camera.StayInLevel = true; 51 } 52 53 54 void Valikko() 55 { 56 ClearAll(); 57 valikonKohdat = new List<Label>(); 58 Level.Background.Image = splashscreen; 59 Level.BackgroundColor = Color.Black; 60 Label kohta1 = new Label("New Game"); 61 kohta1.Position = new Vector(0, 40); 62 valikonKohdat.Add(kohta1); 63 64 Label kohta2 = new Label("Exit"); 65 kohta2.Position = new Vector(0, -40); 66 valikonKohdat.Add(kohta2); 67 68 foreach (Label valikonKohta in valikonKohdat) 69 { 70 Add(valikonKohta); 71 } 72 73 Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, alotapeli, null); 74 Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, Exit, null); 75 76 Mouse.IsCursorVisible = true; 77 Mouse.ListenMovement(1.0, ValikossaLiikkuminen, null); 78 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, ""); 79 } 80 81 void ValikossaLiikkuminen(AnalogState hiirenTila) 82 { 83 foreach (Label kohta in valikonKohdat) 84 { 85 if (Mouse.IsCursorOn(kohta)) 86 { 87 kohta.TextColor = Color.Green; 88 } 89 else 90 { 91 kohta.TextColor = Color.White; 92 } 93 94 } 37 95 } 38 96 … … 47 105 Level.CreateBorders(); 48 106 Level.Background.CreateGradient(Color.Black, Color.Pink); 107 IsMouseVisible = false; 49 108 50 109 } … … 69 128 pelaaja1 = new PlatformCharacter(30, 40); 70 129 pelaaja1.Mass = 10.0; 71 pelaaja1.Image = pelaajanKuva; 130 pelaaja1.LeftWalkingAnimation = norsuleft; 131 pelaaja1.RightWalkingAnimation = norsuRight; 72 132 AddCollisionHandler(pelaaja1, osuTahteen); 73 133 return pelaaja1; … … 76 136 77 137 78 79 138 void lisaaNappaimet() 80 139 { 81 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu pelistä");82 140 83 141 Keyboard.Listen(Key.Left, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); … … 103 161 if (kohde.Tag.ToString() == "tahti") 104 162 { 105 MessageDisplay.Add("Kristalli kerätty!"); 163 Add(rajahdys); 164 //double X = 0; 165 //double Y = 0; 166 int pMaara = 600; 167 rajahdys.MaxScale = 6; 168 rajahdys.MinScale = 1; 169 rajahdys.MinLifetime = 0.1; 170 rajahdys.MaxLifetime = 0.5; 171 rajahdys.AddEffect( kohde.Position, pMaara ); 172 106 173 kohde.Destroy(); 107 174 MessageDisplay.Add("Keräsit kristallin!!"); 175 MessageDisplay.TextColor = Color.White; 108 176 } 109 177 } -
2011/26/JoelH/THPeli/THPeli/THPeli.csproj
r2244 r2381 19 19 <ApplicationIcon>Game.ico</ApplicationIcon> 20 20 <Thumbnail>GameThumbnail.png</Thumbnail> 21 <PublishUrl>publish\</PublishUrl> 21 <IsWebBootstrapper>false</IsWebBootstrapper> 22 <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath> 23 <PublishUrl>C:\MyTemp\JoelH\</PublishUrl> 22 24 <Install>true</Install> 23 25 <InstallFrom>Disk</InstallFrom> … … 31 33 <ApplicationRevision>0</ApplicationRevision> 32 34 <ApplicationVersion>1.0.0.%2a</ApplicationVersion> 33 <IsWebBootstrapper>false</IsWebBootstrapper>34 35 <UseApplicationTrust>false</UseApplicationTrust> 35 36 <BootstrapperEnabled>true</BootstrapperEnabled> 36 <ReferencePath>$(registry:HKEY_LOCAL_MACHINE\Software\Jypeli@Install_Dir)\lib\x86</ReferencePath>37 37 </PropertyGroup> 38 38 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> … … 116 116 </ItemGroup> 117 117 <ItemGroup> 118 <Content Include="explosio.png" /> 118 119 <Content Include="Game Theme.mp3" /> 119 120 <Content Include="Game.ico" /> … … 122 123 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 123 124 </Content> 125 <Content Include="norsuidle.png" /> 126 <Content Include="norsuidlesame.png" /> 127 <Content Include="norsuwalkingleft.png" /> 124 128 </ItemGroup> 125 129 <ItemGroup> -
2011/26/JoelH/THPeli/THPeli/kentta1.txt
r2310 r2381 1 ############################################################## 2 # 3 # 4 # 5 # #### * * * * # 6 ## # ######### ### ##### # # ### # # # 7 ## ** # 8 ## ###### # 9 #### *# * * # ########### # 10 ### ## ## ###### # ## # 11 # # # # ### # # # # #### # 12 # # # # # 13 * # # # ##### # 14 ## # # # # 15 * # # ####### # 16 ## # # * # 17 # # #### # 18 * * #* # 19 # # ## # ## # 20 N ## # * ### # A # 21 ####### ############AA###########AAA#######AA################ 22 # # # # 23 # # # # 1 ############################################################## # 2 # # 3 # # 4 # # 5 # #### * * * * # # 6 ## # ######### ### ##### # # ### # # # # 7 ## ** # # 8 ## ###### # # 9 #### *# * * # ########### ### # 10 ### ## ## ###### # ## ######## # # 11 # # # # ### # # # # #### # # 12 # # # # # ########## # 13 * # # # ##### # # 14 ## # # # # # 15 * # # ####### # ** # 16 ## # # * # ##### # 17 # # #### # # # 18 * * #* # # 19 # # ## # ## # # # 20 N ## # * ### # # ## * # 21 ####### ############ ########### ####### ################ ## # # 22 # # # # ** # 23 # # # ############# # 24 ### # 25 ######### ######## ### ## # 26 # 27 # 28 # 29 # 30 # 31 # 32 # 33 # 34 # 35 # 36 # 37 # 38 # 39 # 40 # 41 # 42 # 43 # 44 # -
2011/26/JoelH/THPeli/THPeliContent/THPeliContent.contentproj
r2310 r2381 82 82 </Compile> 83 83 </ItemGroup> 84 <ItemGroup> 85 <Compile Include="norsuidle.png"> 86 <Name>norsuidle</Name> 87 <Importer>TextureImporter</Importer> 88 <Processor>TextureProcessor</Processor> 89 </Compile> 90 </ItemGroup> 91 <ItemGroup> 92 <Compile Include="norsuwalkingleft.png"> 93 <Name>norsuwalkingleft</Name> 94 <Importer>TextureImporter</Importer> 95 <Processor>TextureProcessor</Processor> 96 </Compile> 97 </ItemGroup> 98 <ItemGroup> 99 <Compile Include="anothernorsu.png"> 100 <Name>anothernorsu</Name> 101 <Importer>TextureImporter</Importer> 102 <Processor>TextureProcessor</Processor> 103 </Compile> 104 </ItemGroup> 105 <ItemGroup> 106 <Compile Include="explosio.png"> 107 <Name>explosio</Name> 108 <Importer>TextureImporter</Importer> 109 <Processor>TextureProcessor</Processor> 110 </Compile> 111 </ItemGroup> 84 112 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 85 113 <!-- 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.