Changeset 2992
- Timestamp:
- 2012-06-13 14:54:43 (11 years ago)
- Location:
- 2012/24/AnttoniS
- Files:
-
- 13 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/24/AnttoniS/Ufot/Ufot/Ufot/Ufot.cs
r2977 r2992 9 9 public class Ufot : PhysicsGame 10 10 { 11 PhysicsObject vartalo; 11 PeliHahmo vartalo; 12 DoubleMeter voimaMittari; 12 13 PhysicsObject pää; 13 14 Image ukko = LoadImage("ukko"); 14 15 ExplosionSystem rajahdys; 16 PhysicsObject olio; 17 Image olioKuva = LoadImage("olio"); 18 Image taustakuva = LoadImage("background"); 15 19 public override void Begin() 16 20 { 17 21 // TODO: Kirjoita ohjelmakoodisi tähän 22 voimaMittari = new DoubleMeter(10); 23 voimaMittari.MaxValue = 10; 24 ProgressBar voimaPalkki = new ProgressBar(200, 10); 25 voimaPalkki.BindTo(voimaMittari); 26 Add(voimaPalkki); 27 voimaPalkki.X = Screen.Right - 150; 28 voimaPalkki.Y = Screen.Top - 300; 29 voimaPalkki.Angle = Angle.RightAngle; 30 voimaPalkki.BarColor = Color.Green; 31 voimaPalkki.BorderColor = Color.White; 32 voimaPalkki.Angle = Angle.FromDegrees(0); 33 34 18 35 Level.CreateBorders(false); 19 36 Level.BackgroundColor = Color.LightGray; 20 Smoke savu = new Smoke(); 21 savu.Position = new Vector(Level.Left + 30, -300); 22 Add(savu); 23 Wind = new Vector(80, 10); 37 Level.Background.Image = taustakuva; 38 24 39 25 26 vartalo = new PhysicsObject(75, 150); 27 vartalo.Mass = (10000); 40 rajahdys = new ExplosionSystem(LoadImage("rajahdys"), 500); 41 rajahdys.MaxVelocity = 10; 42 rajahdys.MinVelocity = 5; 43 rajahdys.BlendMode = BlendMode.Additive; 44 Add(rajahdys); 45 46 vartalo = new PeliHahmo(75, 150); 47 vartalo.Mass = (9999999); 28 48 PlasmaCannon ase = new PlasmaCannon(30, 20); 29 49 vartalo.Add(ase); 30 50 ase.X = 20; 31 Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", ase);32 Mouse.IsCursorVisible = true;51 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, AmmuAseella, "Ammu", ase); 52 Mouse.IsCursorVisible = false; 33 53 Mouse.ListenMovement(0.1, KuunteleLiiketta, null); 34 54 vartalo.X = -0.0; … … 36 56 vartalo.Color = Color.Beige; 37 57 vartalo.Shape = Shape.Ellipse; 38 Gravity = new Vector(0.0, -0.0);58 Gravity = new Vector(0.0, 0.0); 39 59 vartalo.Restitution = 1.0; 40 60 Add(vartalo); 61 vartalo.CollisionIgnoreGroup = 0; 41 62 vartalo.Image = ukko; 42 63 64 olio = new PhysicsObject(500, 220); 65 olio.Color = Color.Gray; 66 olio.Shape = Shape.Circle; 67 olio.X = 0.0; 68 olio.Y = 185; 69 Add (olio); 70 olio.IgnoresCollisionResponse = false; 71 LaserGun laserPyssy = new LaserGun(20, 5); 72 olio.Add(laserPyssy); 73 // laserPyssy.ProjectileCollision = LaserSadeOsuu; 74 olio.Image = olioKuva; 75 RandomMoverBrain satunnaisAivot = new RandomMoverBrain(); 76 olio.Brain = satunnaisAivot; 77 satunnaisAivot.Active = true; 78 satunnaisAivot.Speed = 7000; 43 79 44 80 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 81 Keyboard.Listen(Key.Space, ButtonState.Pressed, 82 VahennaVoimia, "Vähennä pelaajan voimia"); 45 83 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 46 84 } … … 48 86 void KuunteleLiiketta(AnalogState hiirenTila) 49 87 { 88 if(Mouse.PositionOnWorld.X > Level.Left && Mouse.PositionOnWorld.X < Level.Right) 50 89 vartalo.X = Mouse.PositionOnWorld.X; 51 90 } … … 57 96 if (ammus != null) 58 97 { 59 ammus.Size *= 1; 98 ammus.Size *= 2; 99 ammus.Color = Color.Yellow; 100 AddCollisionHandler(ammus, AmmusTormaa); 60 101 } 61 102 … … 63 104 } 64 105 106 void AmmusTormaa(PhysicsObject tormaaja, PhysicsObject kohde) 107 { 108 rajahdys.AddEffect(tormaaja.Position, 40); 109 tormaaja.Destroy(); 110 111 } 112 113 class PeliHahmo : PhysicsObject 114 { 115 public int Elamat = 3; 116 117 public PeliHahmo(double leveys, double korkeus) 118 : base(leveys, korkeus) 119 { 120 } 121 } 122 123 void VahennaVoimia() 124 { 125 voimaMittari.Value--; 126 } 127 128 void VoimaLoppui(double mittarinArvo) 129 { 130 MessageDisplay.Add("Voimat loppuivat, voi voi."); 131 } 132 133 IntMeter pisteLaskuri; 134 135 void LuoLaskuri() 136 { 137 pisteLaskuri = new IntMeter(0); 138 139 Label pisteNaytto = new Label(); 140 pisteNaytto.X = Screen.Left + 100; 141 pisteNaytto.Y = Screen.Top - 100; 142 pisteNaytto.TextColor = Color.Black; 143 pisteNaytto.Color = Color.White; 144 145 pisteNaytto.BindTo(pisteLaskuri); 146 Add(pisteNaytto); 147 148 pisteNaytto.BindTo(pisteLaskuri); 149 Add(pisteNaytto); 150 151 Label pisteTeksti = new Label("Elämät: "); 152 pisteTeksti.X = Screen.Left + 50; 153 pisteTeksti.Y = Screen.Top - 100; 154 pisteTeksti.TextColor = Color.Red; 155 pisteTeksti.Color = Color.Black; 156 Add(pisteTeksti); 157 } 65 158 } -
2012/24/AnttoniS/Ufot/Ufot/Ufot/Ufot.csproj
r2968 r2992 62 62 </PropertyGroup> 63 63 <ItemGroup> 64 <Reference Include="Jypeli4"> 64 <Reference Include="Jypeli"> 65 <HintPath>..\..\..\Jypeli.dll</HintPath> 65 66 </Reference> 66 67 <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> -
2012/24/AnttoniS/Ufot/Ufot/Ufot/Ufot.csproj.Debug.cachefile
r2977 r2992 1 1 Content\ukko.xnb 2 Content\rajahdys.xnb 3 Content\olio.xnb 4 Content\taustakuva.xnb 5 Content\background.xnb -
2012/24/AnttoniS/Ufot/Ufot/Ufot/obj/x86/Debug/ContentPipeline-{79138FA0-960A-4FD2-BC0E-B4BD422F72DE}.xml
r2977 r2992 10 10 <Output>C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\ukko.xnb</Output> 11 11 <Time>2012-06-13T10:17:10.358499+03:00</Time> 12 </Item> 13 <Item> 14 <Source>rajahdys.png</Source> 15 <Name>rajahdys</Name> 16 <Importer>TextureImporter</Importer> 17 <Processor>TextureProcessor</Processor> 18 <Options>None</Options> 19 <Output>C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\rajahdys.xnb</Output> 20 <Time>2012-06-13T12:17:00.413599+03:00</Time> 21 </Item> 22 <Item> 23 <Source>olio.png</Source> 24 <Name>olio</Name> 25 <Importer>TextureImporter</Importer> 26 <Processor>TextureProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\olio.xnb</Output> 29 <Time>2012-06-13T12:43:18.372199+03:00</Time> 30 </Item> 31 <Item> 32 <Source>taustakuva.png</Source> 33 <Name>taustakuva</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\taustakuva.xnb</Output> 38 <Time>2012-06-13T13:33:44.067799+03:00</Time> 39 </Item> 40 <Item> 41 <Source>background.png</Source> 42 <Name>background</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\background.xnb</Output> 47 <Time>2012-06-13T14:36:28.675484+03:00</Time> 12 48 </Item> 13 49 <BuildSuccessful>true</BuildSuccessful> -
2012/24/AnttoniS/Ufot/Ufot/Ufot/obj/x86/Debug/Ufot.csproj.FileListAbsolute.txt
r2977 r2992 1 1 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Ufot.exe 2 2 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Ufot.pdb 3 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli4.dll4 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli4.xml5 3 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\obj\x86\Debug\ResolveAssemblyReference.cache 6 4 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt … … 8 6 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\obj\x86\Debug\Ufot.pdb 9 7 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\ukko.xnb 8 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\rajahdys.xnb 9 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\olio.xnb 10 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\taustakuva.xnb 11 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli.dll 12 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli.xml 13 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\background.xnb -
2012/24/AnttoniS/Ufot/Ufot/Ufot/obj/x86/Debug/cachefile-{79138FA0-960A-4FD2-BC0E-B4BD422F72DE}-targetpath.txt
r2977 r2992 1 1 Content\ukko.xnb 2 Content\rajahdys.xnb 3 Content\olio.xnb 4 Content\taustakuva.xnb 5 Content\background.xnb -
2012/24/AnttoniS/Ufot/Ufot/UfotContent/UfotContent.contentproj
r2977 r2992 51 51 </Compile> 52 52 </ItemGroup> 53 <ItemGroup> 54 <Compile Include="rajahdys.png"> 55 <Name>rajahdys</Name> 56 <Importer>TextureImporter</Importer> 57 <Processor>TextureProcessor</Processor> 58 </Compile> 59 </ItemGroup> 60 <ItemGroup> 61 <Compile Include="olio.png"> 62 <Name>olio</Name> 63 <Importer>TextureImporter</Importer> 64 <Processor>TextureProcessor</Processor> 65 </Compile> 66 </ItemGroup> 67 <ItemGroup> 68 <Compile Include="taustakuva.png"> 69 <Name>taustakuva</Name> 70 <Importer>TextureImporter</Importer> 71 <Processor>TextureProcessor</Processor> 72 </Compile> 73 </ItemGroup> 74 <ItemGroup> 75 <Compile Include="background.png"> 76 <Name>background</Name> 77 <Importer>TextureImporter</Importer> 78 <Processor>TextureProcessor</Processor> 79 </Compile> 80 </ItemGroup> 53 81 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 54 82 <!-- 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.