Changeset 9116


Ignore:
Timestamp:
2017-07-26 11:46:49 (2 years ago)
Author:
npo17_56
Message:

Kranun heitto

Location:
2017/30/OlliL
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • 2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb helicopterContent/Bomb helicopterContent.contentproj

    r9101 r9116  
    7878    </Compile> 
    7979  </ItemGroup> 
     80  <ItemGroup> 
     81    <Compile Include="laukaisin.png"> 
     82      <Name>laukaisin</Name> 
     83      <Importer>TextureImporter</Importer> 
     84      <Processor>TextureProcessor</Processor> 
     85    </Compile> 
     86  </ItemGroup> 
    8087  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    8188  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb_helicopter/Bomb_helicopter.cs

    r9101 r9116  
    1717    private Image[] ropelinPyoriminen = LoadImages("ropeli1", "ropeli2"); 
    1818    PhysicsObject helikopteri; 
     19    Image laukaisin = LoadImage("laukaisin"); 
     20    PhysicsObject laukaisija; 
     21     
    1922 
    20      
    2123 
    2224    public override void Begin() 
     
    2729        Camera.ZoomToLevel(); 
    2830        Camera.StayInLevel = true; 
    29         LuoHelikopteri(); 
     31        LuoHelikopteri(-2500, 0.0); 
    3032        AsetaOhjaimet(); 
    3133        Camera.Follow(helikopteri); 
     34        Laukaisija(-100, -400); 
     35        Laukaisija(-900, -450); 
     36 
     37        Gravity = new Vector(0.0, -800.0); 
    3238 
    3339        Level.Background.Image = taustaKuva; 
     
    3541        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    3642    } 
    37  
    38      
    39     
    40      
    4143 
    4244    void AsetaOhjaimet() 
     
    5052        Keyboard.Listen(Key.A, ButtonState.Down, AsetaNopeus, "Pelaaja 1: Kopteri ylös", helikopteri, nopeusVasen); 
    5153        Keyboard.Listen(Key.A, ButtonState.Released, AsetaNopeus, null, helikopteri, Vector.Zero); 
     54 
     55        Keyboard.Listen(Key.Space, ButtonState.Pressed, HeitaKranaatti, "Pelaaja 1: Heitä kranaatti", helikopteri); 
    5256    } 
     57 
     58     
    5359 
    5460    void AsetaNopeus(PhysicsObject helikopteri, Vector nopeus) 
    5561    { 
    56         helikopteri.Velocity = nopeus; 
     62        if (helikopteri.Y >= Level.Top - 50 && nopeus.Y >0) helikopteri.Velocity = new Vector(helikopteri.Velocity.X, 0); 
     63        else helikopteri.Velocity = nopeus; 
    5764    } 
    5865 
    59     void LuoHelikopteri() 
     66    void LuoHelikopteri(double x, double y) 
    6067    { 
    6168        helikopteri = new PhysicsObject(510, 133); 
    62         //Image kuva = LoadImage("Helikopteri6", "Helikopteri7"); 
    63         //helikopteri.Shape = Shape.FromImage(kuva); 
    64         //helikopteri.Image = kuva; 
     69        helikopteri.X = x; 
     70        helikopteri.Y = y; 
    6571        ropelinPyoriminen = LoadImages("Helikopteri10", "Helikopteri11"); 
    6672        helikopteri.Animation = new Animation(ropelinPyoriminen); 
    6773        helikopteri.Animation.Start(); 
     74        helikopteri.CanRotate = false; 
     75        helikopteri.IgnoresGravity = true; 
     76        AddCollisionHandler(helikopteri, HelikopteriTormaa); 
     77        helikopteri.IgnoresCollisionResponse = true; 
    6878        Add(helikopteri); 
     79 
     80         
     81    } 
     82 
     83    void HelikopteriTormaa(PhysicsObject tormaaja, PhysicsObject kohde) 
     84    { 
     85        tormaaja.Velocity = new Vector(tormaaja.Velocity.X, 0); 
     86    } 
     87    void HeitaKranaatti(PhysicsObject helikopteri) 
     88    { 
     89        Grenade kranu = new Grenade(3.0); 
     90        kranu.Position = new Vector (helikopteri.X, helikopteri.Y -20); 
     91        Add(kranu); 
     92    } 
     93 
     94    void Laukaisija(double x, double y) 
     95    { 
     96        laukaisija = new PhysicsObject(60.0, 60.0); 
     97        laukaisija.X = x; 
     98        laukaisija.Y = y; 
     99        laukaisija.Width = 100.0; 
     100        laukaisija.Height = 100.0; 
     101        laukaisija.Image = laukaisin; 
     102        Add(laukaisija); 
     103        laukaisija.MakeStatic(); 
    69104    } 
    70105} 
  • 2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb_helicopter/Bomb_helicopter.csproj.Debug.cachefile

    r9101 r9116  
    44Content\Helikopteri11.xnb 
    55Content\Kentta2.xnb 
     6Content\laukaisin.xnb 
  • 2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb_helicopter/obj/x86/Debug/Bomb_helicopter.csproj.FileListAbsolute.txt

    r9101 r9116  
    1212C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\Helikopteri11.xnb 
    1313C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\Kentta2.xnb 
     14C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\laukaisin.xnb 
  • 2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb_helicopter/obj/x86/Debug/ContentPipeline-{0FA830EB-FE46-4508-A0B0-AB31DCF90F68}.xml

    r9101 r9116  
    99      <Options>None</Options> 
    1010      <Output>C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\ropeli1.xnb</Output> 
    11       <Time>2017-07-25T13:03:41.2774304+03:00</Time> 
     11      <Time>2017-07-26T09:56:09.2622318+03:00</Time> 
    1212    </Item> 
    1313    <Item> 
     
    1818      <Options>None</Options> 
    1919      <Output>C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\ropeli2.xnb</Output> 
    20       <Time>2017-07-25T13:03:41.2774304+03:00</Time> 
     20      <Time>2017-07-26T09:56:08.9192993+03:00</Time> 
    2121    </Item> 
    2222    <Item> 
     
    2727      <Options>None</Options> 
    2828      <Output>C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\Helikopteri10.xnb</Output> 
    29       <Time>2017-07-25T13:31:36.432312+03:00</Time> 
     29      <Time>2017-07-26T09:56:08.9263005+03:00</Time> 
    3030    </Item> 
    3131    <Item> 
     
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\Helikopteri11.xnb</Output> 
    38       <Time>2017-07-25T13:31:40.9479642+03:00</Time> 
     38      <Time>2017-07-26T09:56:08.933299+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    4545      <Options>None</Options> 
    4646      <Output>C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\Kentta2.xnb</Output> 
    47       <Time>2017-07-25T14:33:53.4748382+03:00</Time> 
     47      <Time>2017-07-26T09:56:09.2492296+03:00</Time> 
     48    </Item> 
     49    <Item> 
     50      <Source>laukaisin.png</Source> 
     51      <Name>laukaisin</Name> 
     52      <Importer>TextureImporter</Importer> 
     53      <Processor>TextureProcessor</Processor> 
     54      <Options>None</Options> 
     55      <Output>C:\MyTemp\OlliL\Bomb helicopter\Bomb helicopter\Bomb_helicopter\bin\x86\Debug\Content\laukaisin.xnb</Output> 
     56      <Time>2017-07-26T10:20:13.8885858+03:00</Time> 
    4857    </Item> 
    4958    <BuildSuccessful>true</BuildSuccessful> 
     
    94103      <Assembly> 
    95104        <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> 
    96         <Value>2017-07-05T13:36:30.5527951+03:00</Value> 
     105        <Value>2017-06-26T16:10:39.4209235+03:00</Value> 
    97106      </Assembly> 
    98107    </Assemblies> 
  • 2017/30/OlliL/Bomb helicopter/Bomb helicopter/Bomb_helicopter/obj/x86/Debug/cachefile-{0FA830EB-FE46-4508-A0B0-AB31DCF90F68}-targetpath.txt

    r9101 r9116  
    44Content\Helikopteri11.xnb 
    55Content\Kentta2.xnb 
     6Content\laukaisin.xnb 
Note: See TracChangeset for help on using the changeset viewer.