Changeset 2992


Ignore:
Timestamp:
2012-06-13 14:54:43 (11 years ago)
Author:
sijoseha
Message:

Talletus.

Location:
2012/24/AnttoniS
Files:
13 added
15 edited

Legend:

Unmodified
Added
Removed
  • 2012/24/AnttoniS/Ufot/Ufot/Ufot/Ufot.cs

    r2977 r2992  
    99public class Ufot : PhysicsGame 
    1010{ 
    11     PhysicsObject vartalo; 
     11    PeliHahmo vartalo; 
     12    DoubleMeter voimaMittari; 
    1213    PhysicsObject pää; 
    1314    Image ukko = LoadImage("ukko"); 
    14      
     15    ExplosionSystem rajahdys; 
     16    PhysicsObject olio; 
     17    Image olioKuva = LoadImage("olio"); 
     18    Image taustakuva = LoadImage("background"); 
    1519    public override void Begin() 
    1620    { 
    1721        // 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 
    1835        Level.CreateBorders(false); 
    1936        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         
    2439 
    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); 
    2848        PlasmaCannon ase = new PlasmaCannon(30, 20); 
    2949        vartalo.Add(ase); 
    3050        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; 
    3353        Mouse.ListenMovement(0.1, KuunteleLiiketta, null); 
    3454        vartalo.X = -0.0; 
     
    3656        vartalo.Color = Color.Beige; 
    3757        vartalo.Shape = Shape.Ellipse; 
    38         Gravity = new Vector(0.0, -0.0); 
     58        Gravity = new Vector(0.0, 0.0); 
    3959        vartalo.Restitution = 1.0; 
    4060        Add(vartalo); 
     61        vartalo.CollisionIgnoreGroup = 0; 
    4162        vartalo.Image = ukko; 
    4263 
     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; 
    4379 
    4480        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
     81        Keyboard.Listen(Key.Space, ButtonState.Pressed, 
     82                     VahennaVoimia, "Vähennä pelaajan voimia"); 
    4583        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    4684    } 
     
    4886    void KuunteleLiiketta(AnalogState hiirenTila) 
    4987    { 
     88        if(Mouse.PositionOnWorld.X > Level.Left && Mouse.PositionOnWorld.X < Level.Right) 
    5089        vartalo.X = Mouse.PositionOnWorld.X; 
    5190    } 
     
    5796        if (ammus != null) 
    5897        { 
    59             ammus.Size *= 1; 
     98            ammus.Size *= 2; 
     99            ammus.Color = Color.Yellow; 
     100            AddCollisionHandler(ammus, AmmusTormaa); 
    60101        } 
    61102 
     
    63104    } 
    64105 
     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    } 
    65158} 
  • 2012/24/AnttoniS/Ufot/Ufot/Ufot/Ufot.csproj

    r2968 r2992  
    6262  </PropertyGroup> 
    6363  <ItemGroup> 
    64     <Reference Include="Jypeli4"> 
     64    <Reference Include="Jypeli"> 
     65      <HintPath>..\..\..\Jypeli.dll</HintPath> 
    6566    </Reference> 
    6667    <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  
    11Content\ukko.xnb 
     2Content\rajahdys.xnb 
     3Content\olio.xnb 
     4Content\taustakuva.xnb 
     5Content\background.xnb 
  • 2012/24/AnttoniS/Ufot/Ufot/Ufot/obj/x86/Debug/ContentPipeline-{79138FA0-960A-4FD2-BC0E-B4BD422F72DE}.xml

    r2977 r2992  
    1010      <Output>C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\ukko.xnb</Output> 
    1111      <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> 
    1248    </Item> 
    1349    <BuildSuccessful>true</BuildSuccessful> 
  • 2012/24/AnttoniS/Ufot/Ufot/Ufot/obj/x86/Debug/Ufot.csproj.FileListAbsolute.txt

    r2977 r2992  
    11C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Ufot.exe 
    22C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Ufot.pdb 
    3 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli4.dll 
    4 C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli4.xml 
    53C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\obj\x86\Debug\ResolveAssemblyReference.cache 
    64C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt 
     
    86C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\obj\x86\Debug\Ufot.pdb 
    97C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\ukko.xnb 
     8C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\rajahdys.xnb 
     9C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\olio.xnb 
     10C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Content\taustakuva.xnb 
     11C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli.dll 
     12C:\MyTemp\AnttoniS\Ufot\Ufot\Ufot\bin\x86\Debug\Jypeli.xml 
     13C:\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  
    11Content\ukko.xnb 
     2Content\rajahdys.xnb 
     3Content\olio.xnb 
     4Content\taustakuva.xnb 
     5Content\background.xnb 
  • 2012/24/AnttoniS/Ufot/Ufot/UfotContent/UfotContent.contentproj

    r2977 r2992  
    5151    </Compile> 
    5252  </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> 
    5381  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    5482  <!--  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.