Changeset 3737 for 2012/30


Ignore:
Timestamp:
2012-07-25 10:08:39 (11 years ago)
Author:
tasalmik
Message:

Talletus.

Location:
2012/30/TapaniS/The Slayer task Marsu/The Slayer task Marsu
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2012/30/TapaniS/The Slayer task Marsu/The Slayer task Marsu/The Slayer task Marsu/The_Slayer_task_Marsu.cs

    r3716 r3737  
    99public class The_Slayer_task_Marsu : PhysicsGame 
    1010{ 
    11  
    1211    PlatformCharacter pelaaja; 
    1312    Image pelaajanKuva = LoadImage("ok"); 
     13    PlatformCharacter2 vihu; 
     14    Image vihunKuva = LoadImage("Marsuvihu1"); 
    1415 
    1516 
     
    2021        Add(alkuValikko); 
    2122        alkuValikko.ItemSelected += PainettiinValikonNappia; 
    22  
    23  
    24  
    2523    } 
    2624 
     
    2826    { 
    2927        Gravity = new Vector(0.0, -800.0); 
    30  
    31  
    3228        ColorTileMap ruudut = ColorTileMap.FromLevelAsset("Kentta"); 
    33  
    3429        Camera.Zoom(1.7); 
    35  
    3630        ruudut.SetTileMethod(Color.BrightGreen, LuoTaso); 
    3731        ruudut.SetTileMethod(Color.Black, LuoPelaaja); 
    38         ruudut.SetTileMethod(Color.Yellow, LuoVihollinen); 
     32        ruudut.SetTileMethod(Color.Gold, LuoVihollinen); 
     33        ruudut.SetTileMethod(Color.Maroon, LuoMaa); 
     34        ruudut.SetTileMethod(Color.LimeGreen, LuoKukka); 
    3935 
    4036        ruudut.Execute(20, 20); 
    4137        Level.CreateBorders(); 
    4238        AsetaOhjaimet(); 
    43  
    4439    } 
    4540 
     
    4843        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    4944        Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppaa, "Hyppää"); 
    50         Keyboard.Listen(Key.D, ButtonState.Pressed, Kavele, "Kävele", 355.0); 
    51         Keyboard.Listen(Key.A, ButtonState.Pressed, Kavele, null, -355.0); 
     45        Keyboard.Listen(Key.D, ButtonState.Down, Kavele, "Kävele", 250.0); 
     46        Keyboard.Listen(Key.A, ButtonState.Down, Kavele, null, -250.0); 
    5247        Keyboard.Listen(Key.S, ButtonState.Pressed, Kyykkyyn, "Kyykkyyn"); 
    53  
    54         } 
     48        Keyboard.Listen(Key.S, ButtonState.Released, NouseYlos, ""); 
     49        Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pelaaja.Weapon); 
     50    } 
    5551 
    5652    void PainettiinValikonNappia(int valinta) 
     
    6965        } 
    7066    } 
     67 
    7168    void LuoTaso(Vector paikka, double leveys, double korkeus) 
    7269    { 
     
    8178 
    8279    } 
     80    void LuoMaa(Vector paikka, double leveys, double korkeus) 
     81    { 
     82        PhysicsObject maa = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     83        maa.Position = paikka; 
     84        //maa.Image = groundImage; 
     85        maa.CollisionIgnoreGroup = 1; 
     86        maa.Color = Color.Maroon; 
     87        Add(maa); 
     88 
     89 
     90 
     91 
     92 
     93    } 
     94    void LuoKukka(Vector paikka, double leveys, double korkeus) 
     95    { 
     96        PhysicsObject kukka = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     97        kukka.Position = paikka; 
     98        //maa.Image = groundImage; 
     99        kukka.CollisionIgnoreGroup = 1; 
     100        kukka.Color = Color.LimeGreen; 
     101        Add(kukka); 
     102 
     103 
     104 
     105    } 
     106 
     107 
     108 
     109 
     110 
    83111 
    84112    void LuoPelaaja(Vector paikka, double leveys, double korkeus) 
     
    88116        Add(pelaaja); 
    89117        pelaaja.Image = pelaajanKuva; 
     118        AssaultRifle ase = new AssaultRifle(10, 10); 
     119        pelaaja.Weapon = ase; 
     120        pelaaja.Weapon.AmmoIgnoresGravity = false; 
    90121    } 
    91122 
    92123    void LuoVihollinen(Vector paikka, double leveys, double korkeus) 
    93124    { 
    94  
     125        vihu = new PlatformCharacter2(30, 50); 
     126        vihu.Position = paikka; 
     127        Add(pelaaja); 
     128        vihu.Image = vihunKuva; 
    95129 
    96130 
     
    108142    void Kyykkyyn() 
    109143    { 
    110         pelaaja.Crouch(); 
     144        pelaaja.Height = 20; 
     145    } 
     146    void NouseYlos() 
     147    { 
     148        pelaaja.Height = 50; 
    111149    } 
    112150 
    113   
     151    void AmmuAseella(Weapon ase) 
     152    { 
     153        PhysicsObject ammus = ase.Shoot(); 
     154        ase.FireRate = 1.0; 
     155        ase.AmmoIgnoresGravity = false; 
     156        ase.Ammo.Value = 50; 
    114157 
    115          
    116      
     158 
     159        if (ammus != null) 
     160        { 
     161 
     162        } 
     163    } 
    117164} 
  • 2012/30/TapaniS/The Slayer task Marsu/The Slayer task Marsu/The Slayer task MarsuContent/The Slayer task MarsuContent.contentproj

    r3716 r3737  
    5858    </Compile> 
    5959  </ItemGroup> 
     60  <ItemGroup> 
     61    <Compile Include="Marsuvihu1.png"> 
     62      <Name>Marsuvihu1</Name> 
     63      <Importer>TextureImporter</Importer> 
     64      <Processor>TextureProcessor</Processor> 
     65    </Compile> 
     66  </ItemGroup> 
    6067  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6168  <!--  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.