Ignore:
Timestamp:
2014-07-03 09:22:24 (9 years ago)
Author:
jotapoti
Message:

Räjähdysesimerkki omalla kuvatiedostolla tehty.

Location:
2014/27/JouniP_esimerkki/Efektit/Efektit
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • 2014/27/JouniP_esimerkki/Efektit/Efektit/Efektit/Efektit.cs

    r5312 r5313  
    77using Jypeli.Widgets; 
    88 
     9 
    910public class Efektit : PhysicsGame 
    1011{ 
    1112    PhysicsObject pallo; 
     13    Image partikkeli = LoadImage("rajahdyspartikkeli"); 
    1214 
    1315    public override void Begin() 
    1416    { 
    15         Level.Background.Color = Color.Black; 
     17        LuoKentta(); 
    1618        LisaaPallo(); 
     19        LisaaLaatikoita(); 
    1720 
    1821        LisaaNappainkuuntelijat(); 
    1922 
     23         
     24 
    2025    } 
    2126 
    22     private void LisaaPallo() 
     27    void Rajayta(PhysicsObject tormaaja, PhysicsObject kohde) 
     28    { 
     29        ExplosionSystem rajahdys = new ExplosionSystem(partikkeli, 20); 
     30        Add(rajahdys); 
     31        rajahdys.MinScale = 1; 
     32        rajahdys.MaxScale = 40; 
     33        rajahdys.MaxLifetime = 3; 
     34        rajahdys.AddEffect(tormaaja.X, tormaaja.Y, 10); 
     35    } 
     36 
     37    void LisaaLaatikoita() 
     38    { 
     39        int i = 0; 
     40        while (i < 20) 
     41        { 
     42            PhysicsObject laatikko = new PhysicsObject(30, 30, Shape.Rectangle); 
     43            double minX = Level.Left; 
     44            double minY = Level.Bottom; 
     45            double maxX = Level.Right; 
     46            double maxY = Level.Top; 
     47            laatikko.Position = RandomGen.NextVector(minX, minY, maxX, maxY); 
     48            laatikko.Color = RandomGen.NextColor(); 
     49            laatikko.Tag = "loota"; 
     50            Add(laatikko); 
     51            i++; 
     52        } 
     53    } 
     54 
     55    void LuoKentta() 
     56    { 
     57        Level.Background.Color = Color.Black; 
     58        Level.CreateBorders(); 
     59        Camera.ZoomToLevel(); 
     60    } 
     61 
     62    void LisaaPallo() 
    2363    { 
    2464        pallo = new PhysicsObject(40, 40, Shape.Circle); 
    2565        Add(pallo); 
     66        AddCollisionHandler(pallo, "loota", Rajayta); 
    2667    } 
    2768 
    28     private void LisaaNappainkuuntelijat() 
     69    void LisaaNappainkuuntelijat() 
    2970    { 
    3071        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
  • 2014/27/JouniP_esimerkki/Efektit/Efektit/Efektit/obj/x86/Debug/Efektit.csproj.FileListAbsolute.txt

    r5312 r5313  
    77C:\MyTemp\JouniP_esimerkki\Efektit\Efektit\Efektit\obj\x86\Debug\Efektit.exe 
    88C:\MyTemp\JouniP_esimerkki\Efektit\Efektit\Efektit\obj\x86\Debug\Efektit.pdb 
     9C:\MyTemp\JouniP_esimerkki\Efektit\Efektit\Efektit\bin\x86\Debug\Content\rajahdyspartikkeli.xnb 
  • 2014/27/JouniP_esimerkki/Efektit/Efektit/EfektitContent/EfektitContent.contentproj

    r5312 r5313  
    4545    <Reference Include="AnimationExtension" /> 
    4646  </ItemGroup> 
     47  <ItemGroup> 
     48    <Compile Include="rajahdyspartikkeli.png"> 
     49      <Name>rajahdyspartikkeli</Name> 
     50      <Importer>TextureImporter</Importer> 
     51      <Processor>TextureProcessor</Processor> 
     52    </Compile> 
     53  </ItemGroup> 
    4754  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    4855  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2014/27/JouniP_esimerkki/Efektit/Efektit/EfektitContent/obj/x86/Debug/ContentPipeline.xml

    r5312 r5313  
    22<XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline"> 
    33  <Asset Type="Pipeline:BuildItemCollection"> 
     4    <Item> 
     5      <Source>rajahdyspartikkeli.png</Source> 
     6      <Name>rajahdyspartikkeli</Name> 
     7      <Importer>TextureImporter</Importer> 
     8      <Processor>TextureProcessor</Processor> 
     9      <Options>None</Options> 
     10      <Output>C:\MyTemp\JouniP_esimerkki\Efektit\Efektit\Efektit\bin\x86\Debug\Content\rajahdyspartikkeli.xnb</Output> 
     11      <Time>2014-07-03T09:18:34.0142447+03:00</Time> 
     12    </Item> 
    413    <BuildSuccessful>true</BuildSuccessful> 
    514    <Settings> 
     
    1524    <Assemblies> 
    1625      <Assembly> 
     26        <Key>C:\Program Files (x86)\Jypeli\lib\ContentExtensions\TextFileContentExtension.dll</Key> 
     27        <Value>2014-06-10T15:50:44+03:00</Value> 
     28      </Assembly> 
     29      <Assembly> 
     30        <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key> 
     31        <Value>2010-08-23T12:41:18+03:00</Value> 
     32      </Assembly> 
     33      <Assembly> 
     34        <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.VideoImporters.dll</Key> 
     35        <Value>2010-08-23T12:41:18+03:00</Value> 
     36      </Assembly> 
     37      <Assembly> 
     38        <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll</Key> 
     39        <Value>2010-08-23T12:41:18+03:00</Value> 
     40      </Assembly> 
     41      <Assembly> 
     42        <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll</Key> 
     43        <Value>2010-08-23T12:41:18+03:00</Value> 
     44      </Assembly> 
     45      <Assembly> 
     46        <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll</Key> 
     47        <Value>2010-08-23T12:41:18+03:00</Value> 
     48      </Assembly> 
     49      <Assembly> 
     50        <Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.AudioImporters.dll</Key> 
     51        <Value>2010-08-23T12:41:18+03:00</Value> 
     52      </Assembly> 
     53      <Assembly> 
     54        <Key>C:\Program Files (x86)\Jypeli\lib\ContentExtensions\AnimationExtension.dll</Key> 
     55        <Value>2014-06-10T15:50:44+03:00</Value> 
     56      </Assembly> 
     57      <Assembly> 
    1758        <Key>C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key> 
    1859        <Value>2012-04-04T09:57:00.7719393+03:00</Value> 
Note: See TracChangeset for help on using the changeset viewer.