- Timestamp:
- 2015-06-09 15:14:29 (8 years ago)
- Location:
- 2015/24/TuroR/Omapeli
- Files:
-
- 15 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/24/TuroR/Omapeli/Omapeli/Omapeli/Omapeli.cs
r5908 r5962 9 9 public class Omapeli : PhysicsGame 10 10 { 11 IntMeter pisteLaskuri; 12 13 Image panoksenKuva = LoadImage("panos"); 14 15 Image[] pallonKuvat = LoadImages("apina", "UUS APINA", "sukkamato", "silma", "kännykkä", "Cannon"); 16 11 17 AssaultRifle pelaajan1Ase; 12 18 … … 15 21 public override void Begin() 16 22 { 23 LuoUusiApina(); 17 24 18 Gravity = new Vector(0, - 500);25 Gravity = new Vector(0, -1000); 19 26 20 27 //tykki.ProjectileCollision = AmmusOsui; 28 29 IsFullScreen = false; 30 IsMouseVisible = true; 31 Level.Width = Screen.Width; 32 Level.Height = Screen.Height; 33 34 Level.CreateRightBorder(1.0, false); 35 Level.CreateLeftBorder(1.0, false); 36 PhysicsObject ylaReuna = Level.CreateTopBorder(1.0, false); 21 37 22 IsFullScreen = false;23 Level.Width = Screen.Width;24 38 25 39 Surface alaReuna = Surface.CreateBottom(Level, 30, 100, 40, 10); 40 alaReuna.Y = Screen.Bottom + 100; 26 41 Add(alaReuna); 27 42 28 43 PlatformCharacter2 ukko = new PlatformCharacter2(50, 50); 29 44 ukko.Shape = Shape.Circle; … … 38 53 39 54 pelaajan1Ase.Ammo.Value = 1000; 55 pelaajan1Ase.ProjectileCollision = AmmusOsui; 56 ukko.Add(pelaajan1Ase); 40 57 41 pelaajan1Ase.ProjectileCollision = AmmusOsui; 42 43 44 ukko.Add(pelaajan1Ase); 58 LuoPistelaskuri(); 45 59 46 60 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 47 61 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 48 Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase); 49 Keyboard.Listen(Key.Up, ButtonState.Down, Hyppääukolla, "Hyppää", ukko); 62 Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase); 63 Keyboard.Listen(Key.W, ButtonState.Down, Hyppääukolla, "Hyppää", ukko); 64 Keyboard.Listen(Key.A, ButtonState.Down, Liiku, "Liiku", ukko, Direction.Left); 65 Keyboard.Listen(Key.D, ButtonState.Down, Liiku, "Liiku", ukko, Direction.Right); 66 Mouse.ListenMovement(0.0, HiirenLiikutus, "Tahtaa", ukko); 50 67 } 51 68 52 69 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 53 70 { 54 //ammus.Destroy(); 71 ammus.Destroy(); 72 73 74 75 if (kohde.Tag.Equals("apina")) 76 { 77 Timer.SingleShot(2.0, delegate { LuoUusiApina(); }); 78 kohde.Destroy(); 79 Explosion rajahdys = new Explosion(100); 80 rajahdys.Position = ammus.Position; 81 Add(rajahdys); 82 83 pisteLaskuri.Value += 1; 84 85 } 55 86 } 56 87 … … 61 92 if (ammus != null) 62 93 { 63 //ammus.Size *= 3; 64 //ammus.Image = ... 65 //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 94 ammus.Image = panoksenKuva; 95 ammus.Velocity = ammus.AbsoluteAngle.GetVector()*3000; 66 96 } 67 97 } 68 98 69 99 void Hyppääukolla(PlatformCharacter2 ukko) 70 100 { 71 101 ukko.Jump(500.0); 72 102 } 103 104 void Liiku(PlatformCharacter2 ukko, Direction suunta) 105 { 106 ukko.Walk(suunta); 107 pelaajan1Ase.X = 21.0*suunta.GetVector().X; 108 } 109 110 void HiirenLiikutus(AnalogState Hiiri, PlatformCharacter2 ukko) 111 { 112 pelaajan1Ase.AbsoluteAngle = (Mouse.PositionOnWorld - ukko.Position).Angle; 113 114 } 115 116 void LuoUusiApina() 117 { 118 PhysicsObject apina = new PhysicsObject(50, 50); 119 apina.Shape = Shape.Circle; 120 apina.IgnoresGravity = true; 121 apina.Hit(new Vector(-500, 200)); 122 123 Double Xkoordinaatti = RandomGen.NextDouble(Level.Left, Level.Right); 124 apina.Position = new Vector(Xkoordinaatti,0); 125 apina.Restitution = 1.0; 126 apina.Tag = "apina"; 127 apina.Image = pallonKuvat[RandomGen.NextInt(pallonKuvat.Length)]; 128 Add(apina); 129 } 130 131 void LuoPistelaskuri() 132 { 133 pisteLaskuri = new IntMeter(0); 134 135 Label pisteNaytto = new Label(); 136 pisteNaytto.X = Screen.Left + 100; 137 pisteNaytto.Y = Screen.Top - 100; 138 pisteNaytto.TextColor = Color.Black; 139 pisteNaytto.Color = Color.White; 140 141 pisteNaytto.BindTo(pisteLaskuri); 142 Add(pisteNaytto); 143 } 73 144 } 74 -
2015/24/TuroR/Omapeli/Omapeli/Omapeli/Omapeli.csproj.Debug.cachefile
r5908 r5962 1 1 Content\Cannon.xnb 2 2 Content\ukko.xnb 3 Content\apina.xnb 4 Content\panos.xnb 5 Content\UUS APINA.xnb 6 Content\sukkamato.xnb 7 Content\silma.xnb 8 Content\kÀnnykkÀ.xnb -
2015/24/TuroR/Omapeli/Omapeli/Omapeli/obj/x86/Debug/Omapeli.csproj.FileListAbsolute.txt
r5908 r5962 9 9 C:\MyTemp\TuroR\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.csprojResolveAssemblyReference.cache 10 10 C:\MyTemp\TuroR\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\ukko.xnb 11 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\Cannon.xnb 12 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\ukko.xnb 13 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Omapeli.exe 14 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Omapeli.pdb 15 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Jypeli.dll 16 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Jypeli.xml 17 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.csprojResolveAssemblyReference.cache 18 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt 19 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.exe 20 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.pdb 21 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\apina.xnb 22 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\panos.xnb 23 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\UUS APINA.xnb 24 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\sukkamato.xnb 25 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\silma.xnb 26 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\kÀnnykkÀ.xnb -
2015/24/TuroR/Omapeli/Omapeli/Omapeli/obj/x86/Debug/cachefile-{595E6F62-26BF-42FB-ABC6-C9280882E6ED}-targetpath.txt
r5908 r5962 1 1 Content\Cannon.xnb 2 2 Content\ukko.xnb 3 Content\apina.xnb 4 Content\panos.xnb 5 Content\UUS APINA.xnb 6 Content\sukkamato.xnb 7 Content\silma.xnb 8 Content\kÀnnykkÀ.xnb -
2015/24/TuroR/Omapeli/Omapeli/OmapeliContent/OmapeliContent.contentproj
r5908 r5962 59 59 </Compile> 60 60 </ItemGroup> 61 <ItemGroup> 62 <Compile Include="apina.png"> 63 <Name>apina</Name> 64 <Importer>TextureImporter</Importer> 65 <Processor>TextureProcessor</Processor> 66 </Compile> 67 </ItemGroup> 68 <ItemGroup> 69 <Compile Include="panos.png"> 70 <Name>panos</Name> 71 <Importer>TextureImporter</Importer> 72 <Processor>TextureProcessor</Processor> 73 </Compile> 74 </ItemGroup> 75 <ItemGroup> 76 <Compile Include="UUS APINA.png"> 77 <Name>UUS APINA</Name> 78 <Importer>TextureImporter</Importer> 79 <Processor>TextureProcessor</Processor> 80 </Compile> 81 </ItemGroup> 82 <ItemGroup> 83 <Compile Include="sukkamato.png"> 84 <Name>sukkamato</Name> 85 <Importer>TextureImporter</Importer> 86 <Processor>TextureProcessor</Processor> 87 </Compile> 88 </ItemGroup> 89 <ItemGroup> 90 <Compile Include="silma.png"> 91 <Name>silma</Name> 92 <Importer>TextureImporter</Importer> 93 <Processor>TextureProcessor</Processor> 94 </Compile> 95 </ItemGroup> 96 <ItemGroup> 97 <Compile Include="kännykkä.png"> 98 <Name>kännykkä</Name> 99 <Importer>TextureImporter</Importer> 100 <Processor>TextureProcessor</Processor> 101 </Compile> 102 </ItemGroup> 61 103 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 62 104 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2015/24/TuroR/Omapeli/Omapeli/OmapeliContent/obj/x86/Debug/OmapeliContent.contentproj.FileListAbsolute.txt
r5908 r5962 1 1 C:\MyTemp\TuroR\Omapeli\Omapeli\OmapeliContent\obj\x86\Debug\OmapeliContent.contentprojResolveAssemblyReference.cache 2 C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\OmapeliContent\obj\x86\Debug\OmapeliContent.contentprojResolveAssemblyReference.cache
Note: See TracChangeset
for help on using the changeset viewer.