Changeset 2996


Ignore:
Timestamp:
2012-06-13 14:58:27 (8 years ago)
Author:
aarariih
Message:

Talletus.

Location:
2012/24/AamosR/Thunderbird
Files:
6 added
11 edited

Legend:

Unmodified
Added
Removed
  • 2012/24/AamosR/Thunderbird/Thunderbird/Thunderbird/Thunderbird.cs

    r2974 r2996  
    99public class Thunderbird : PhysicsGame 
    1010{ 
    11     Image taustaKuva = LoadImage("above-blue-sky-wallpaper"); 
     11    Image taustaKuva = LoadImage("taustakuva"); 
    1212     
    1313   Vector nopeusYlos = new Vector(0, 400); 
     
    1616   Vector nopeusVasemmalle = new Vector(-400, 0); 
    1717   Vector nopeusOikealle = new Vector(400, 0); 
     18 
     19   Timer vihollisajastin = new Timer(); 
     20   Timer tahtiajastin = new Timer(); 
    1821     
    1922   PhysicsObject lintu; 
     23   PhysicsObject tahti; 
    2024 
     25   IntMeter pisteLaskuri; 
     26 
     27 
     28   void LuoLaskuri() 
     29   { 
     30       pisteLaskuri = new IntMeter(0); 
     31 
     32       Label pisteNaytto = new Label(); 
     33       pisteNaytto.X = Screen.Left + 100; 
     34       pisteNaytto.Y = Screen.Top + 100; 
     35       pisteNaytto.TextColor = Color.Black; 
     36       pisteNaytto.Color = Color.White; 
     37 
     38       pisteNaytto.BindTo(pisteLaskuri); 
     39       Add(pisteNaytto); 
     40 
     41   } 
     42    
     43 
     44     
     45     
    2146    public override void Begin() 
    2247    { 
    23  
    24         GameObject taustaKuva = new GameObject(Screen.Width, Screen.Height); 
    25         taustaKuva.Image = pilviKuva; 
    26         Add(taustaPilvet, -3); 
    27         GetLayer(-3).RelativeTransition = new Vector(0.5, 0.5); 
     48         
     49         
    2850 
    2951        LuoKentta(); 
    3052        AsetaOhjaimet(); 
     53        LuoLaskuri(); 
    3154 
     55        vihollisajastin.Interval = 2; 
     56        vihollisajastin.Timeout += lisaaVihollinen; 
     57        vihollisajastin.Start(); 
     58 
     59        tahtiajastin.Interval = 1; 
     60        tahtiajastin.Timeout += lisaaTahti; 
     61        tahtiajastin.Start(); 
    3262 
    3363         
     
    3868        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    3969        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     70 
    4071        Keyboard.Listen(Key.W, ButtonState.Down, AsetaNopeus, "Lennä ylöspäin", lintu, nopeusYlos); 
    4172        Keyboard.Listen(Key.W, ButtonState.Released, AsetaNopeus, null, lintu, pysaytaLintu); 
     
    4576        Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus, null, lintu, pysaytaLintu); 
    4677        Keyboard.Listen(Key.D, ButtonState.Down, AsetaNopeus, "Lennä oikealle", lintu, nopeusOikealle); 
     78        Keyboard.Listen(Key.D, ButtonState.Released, AsetaNopeus, null, lintu, pysaytaLintu); 
     79 
     80        Keyboard.Listen(Key.Up, ButtonState.Down, AsetaNopeus, "Lennä ylöspäin", lintu, nopeusYlos); 
     81        Keyboard.Listen(Key.Up, ButtonState.Released, AsetaNopeus, null, lintu, pysaytaLintu); 
     82        Keyboard.Listen(Key.Down, ButtonState.Down, AsetaNopeus, "Lennä alaspäin", lintu, nopeusAlas); 
     83        Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, lintu, pysaytaLintu); 
     84        Keyboard.Listen(Key.Left, ButtonState.Down, AsetaNopeus, "Lennä vasemmalle", lintu, nopeusVasemmalle); 
     85        Keyboard.Listen(Key.Left, ButtonState.Released, AsetaNopeus, null, lintu, pysaytaLintu); 
     86        Keyboard.Listen(Key.Right, ButtonState.Down, AsetaNopeus, "Lennä oikealle", lintu, nopeusOikealle); 
     87        Keyboard.Listen(Key.Right, ButtonState.Released, AsetaNopeus, null, lintu, pysaytaLintu); 
     88        
     89        Keyboard.Listen(Key.Space, ButtonState.Pressed, Ammu, "Ammu"); 
    4790    } 
    4891 
     
    57100        lintu.Shape = Shape.Rectangle; 
    58101        lintu.X = -350; 
     102        lintu.Y = 0; 
     103        lintu.CanRotate = false; 
     104        lintu.Restitution = 0; 
     105        AddCollisionHandler(lintu, "vihollinen", kuolema); 
    59106        Add (lintu); 
    60107 
    61108        Level.Background.CreateGradient(Color.Blue, Color.White); 
     109        Level.CreateBorders(); 
     110         
     111        Camera.ZoomToLevel(); 
    62112 
    63         Camera.ZoomToLevel(); 
    64113    } 
     114 
     115    void lisaaVihollinen() 
     116    { 
     117        PhysicsObject vihollinen = new PhysicsObject(99, 99); 
     118        vihollinen.Shape = Shape.Circle; 
     119        vihollinen.X = Level.Width; 
     120        vihollinen.Y = RandomGen.NextDouble(-342, 342); 
     121        vihollinen.Hit(new Vector(-250, 0)); 
     122        vihollinen.CanRotate = false; 
     123        vihollinen.IgnoresCollisionResponse = true; 
     124        vihollinen.Tag = "vihollinen"; 
     125        Add (vihollinen); 
     126 
     127    } 
     128 
     129    void lisaaTahti() 
     130    { 
     131        tahti = new PhysicsObject(50, 50); 
     132        tahti.Shape = Shape.Star; 
     133        tahti.Color = Color.Yellow; 
     134        tahti.X = Level.Width; 
     135        tahti.Y = RandomGen.NextDouble(-342, 342); 
     136        tahti.Hit(new Vector(-70, 0)); 
     137        tahti.CanRotate = false; 
     138        tahti.IgnoresCollisionResponse = true; 
     139        Add(tahti);  
     140    } 
     141 
     142    void kuolema(IPhysicsObject lintu, IPhysicsObject vihollinen) 
     143    { 
     144        lintu.Destroy(); 
     145    } 
     146 
     147    void Ammu() 
     148    { 
     149        PhysicsObject ammus = new PhysicsObject(60, 40); 
     150        Add (ammus); 
     151        ammus.X = lintu.X; 
     152        ammus.Y = lintu.Y; 
     153        ammus.Shape = Shape.Ellipse; 
     154        ammus.Color = Color.Blue; 
     155        ammus.CanRotate = false; 
     156        ammus.IgnoresCollisionResponse = true; 
     157        AddCollisionHandler(ammus, "vihollinen", vihollisenKuolema); 
     158        ammus.Hit(new Vector(500, 0)); 
     159    } 
     160 
     161    void vihollisenKuolema(IPhysicsObject ammus, IPhysicsObject vihollinen) 
     162    { 
     163        vihollinen.Destroy(); 
     164        ammus.Destroy(); 
     165 
     166        pisteLaskuri.Value = pisteLaskuri.Value + 10; 
     167    } 
     168 
    65169} 
  • 2012/24/AamosR/Thunderbird/Thunderbird/Thunderbird/Thunderbird.csproj

    r2974 r2996  
    116116  </ItemGroup> 
    117117  <ItemGroup> 
    118     <Content Include="above-blue-sky-wallpaper.jpg" /> 
    119118    <Content Include="Game.ico" /> 
    120119    <Content Include="GameThumbnail.png" /> 
  • 2012/24/AamosR/Thunderbird/Thunderbird/Thunderbird/obj/x86/Debug/Thunderbird.csproj.FileListAbsolute.txt

    r2954 r2996  
    77C:\MyTemp\AamosR\Thunderbird\Thunderbird\Thunderbird\obj\x86\Debug\Thunderbird.exe 
    88C:\MyTemp\AamosR\Thunderbird\Thunderbird\Thunderbird\obj\x86\Debug\Thunderbird.pdb 
     9C:\MyTemp\AamosR\Thunderbird\Thunderbird\Thunderbird\bin\x86\Debug\Content\taustakuva.xnb 
  • 2012/24/AamosR/Thunderbird/Thunderbird/ThunderbirdContent/ThunderbirdContent.contentproj

    r2954 r2996  
    4444    <Reference Include="TextFileContentExtension" /> 
    4545  </ItemGroup> 
     46  <ItemGroup> 
     47    <Compile Include="taustakuva.jpg"> 
     48      <Name>taustakuva</Name> 
     49      <Importer>TextureImporter</Importer> 
     50      <Processor>TextureProcessor</Processor> 
     51    </Compile> 
     52  </ItemGroup> 
    4653  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    4754  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2012/24/AamosR/Thunderbird/Thunderbird/ThunderbirdContent/obj/x86/Debug/ContentPipeline.xml

    r2974 r2996  
    22<XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline"> 
    33  <Asset Type="Pipeline:BuildItemCollection"> 
     4    <Item> 
     5      <Source>taustakuva.jpg</Source> 
     6      <Name>taustakuva</Name> 
     7      <Importer>TextureImporter</Importer> 
     8      <Processor>TextureProcessor</Processor> 
     9      <Options>None</Options> 
     10      <Output>C:\MyTemp\AamosR\Thunderbird\Thunderbird\Thunderbird\bin\x86\Debug\Content\taustakuva.xnb</Output> 
     11      <Time>2012-06-13T11:30:28.2767542+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>2012-03-06T17:19:08+02: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-23T13: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-23T13: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-23T13: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-23T13: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-23T13: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-23T13:41:18+03:00</Value> 
     52      </Assembly> 
     53      <Assembly> 
    1754        <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> 
    1855        <Value>2012-01-20T10:28:50.7077545+02:00</Value> 
Note: See TracChangeset for help on using the changeset viewer.