Changeset 7973 for 2015/koodauskerho


Ignore:
Timestamp:
2016-07-07 15:08:32 (3 years ago)
Author:
otosjahn
Message:
 
Location:
2015/koodauskerho/SanteriK
Files:
7 added
11 edited

Legend:

Unmodified
Added
Removed
  • 2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/FastestGunInTown.cs

    r7902 r7973  
    88 
    99public class FastestGunInTown : PhysicsGame 
     10 
    1011{ 
     12     
     13    Image hahmonkuva = LoadImage("hahmo"); 
     14    Image hahmon2kuva = LoadImage("hahmo2"); 
     15    Image ammuskuva = LoadImage("ammus"); 
     16 
     17    PlatformCharacter[] pelaajat = new PlatformCharacter[2]; 
    1118    public override void Begin() 
    1219    { 
    13         // TODO: Kirjoita ohjelmakoodisi tähän 
     20        LuoKentta(); 
    1421 
    15         Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     22        asetaohjaimet(); 
    1623 
    17         PhysicsObject hahmo = new PhysicsObject(40, 20); 
    18        // kissa.Shape = Shape.Rectangle; 
    19         Add(hahmo); 
     24 
     25    } 
     26    void LuoKentta() 
     27    { 
     28        ColorTileMap ruudut = ColorTileMap.FromLevelAsset("PelinKentta"); 
     29        ruudut.SetTileMethod(Color.FromHexCode("#FF4CFF00"), LuoPelaaja, 1); 
     30        ruudut.SetTileMethod(Color.Red, LuoPelaaja, 0); 
     31        ruudut.SetTileMethod(Color.Black, LuoTaso); 
     32        ruudut.Execute(40, 40); 
    2033         
    2134    } 
    22      
     35 
     36    void LuoTaso(Vector paikka, double korkeus, double leveys) 
     37    { 
     38        PhysicsObject taso =  PhysicsObject.CreateStaticObject(leveys, korkeus); 
     39        taso.Position = paikka; 
     40        Add(taso); 
     41        taso.Color = Color.Black; 
     42    } 
     43 
     44    void LuoPelaaja(Vector paikka, double korkeus, double leveys, int indeksi) 
     45    { 
     46        PlatformCharacter hahmo = new PlatformCharacter(200, 200); 
     47        hahmo.Shape = Shape.Rectangle; 
     48        Add(hahmo); 
     49        hahmo.Image = hahmonkuva; 
     50        hahmo.Position = paikka; 
     51        if(indeksi == 1) hahmo.Turn(Direction.Left); 
     52 
     53         AssaultRifle pelaajan1Ase = new AssaultRifle(30, 10); 
     54        pelaajan1Ase.Ammo.Value = 6; 
     55        pelaajan1Ase.ProjectileCollision = AmmusOsui; 
     56        hahmo.Weapon = pelaajan1Ase; 
     57        pelaajat[indeksi] = hahmo; 
     58    } 
     59    void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 
     60    { 
     61        //ammus.Destroy(); 
     62    } 
     63    void AmmuAseella(AssaultRifle ase) 
     64    { 
     65        PhysicsObject ammus = ase.Shoot(); 
     66 
     67        if (ammus != null) 
     68        { 
     69 
     70            ammus.Size *= 3; 
     71            ammus.Image = ammuskuva; 
     72            ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
     73        } 
     74    } 
     75    void asetaohjaimet() 
     76    { 
     77        Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", (AssaultRifle)pelaajat[0].Weapon); 
     78        Keyboard.Listen(Key.LeftShift, ButtonState.Down, AmmuAseella, "Ammu", (AssaultRifle)pelaajat[1].Weapon); 
     79        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     80    } 
     81 
    2382} 
    2483 
  • 2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/FastestGunInTown.csproj.Debug.cachefile

    r7902 r7973  
    22Content\revolveri.xnb 
    33Content\ammus.xnb 
     4Content\PelinKentta.xnb 
     5Content\hahmo2.xnb 
  • 2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/obj/x86/Debug/ContentPipeline-{1322E6E4-46B9-4B14-9148-224F2875B658}.xml

    r7902 r7973  
    2828      <Output>C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\ammus.xnb</Output> 
    2929      <Time>2016-07-06T13:05:47.5204062+03:00</Time> 
     30    </Item> 
     31    <Item> 
     32      <Source>PelinKentta.png</Source> 
     33      <Name>PelinKentta</Name> 
     34      <Importer>TextureImporter</Importer> 
     35      <Processor>TextureProcessor</Processor> 
     36      <Options>None</Options> 
     37      <Output>C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\PelinKentta.xnb</Output> 
     38      <Time>2016-07-07T11:10:56.811584+03:00</Time> 
     39    </Item> 
     40    <Item> 
     41      <Source>hahmo2.png</Source> 
     42      <Name>hahmo2</Name> 
     43      <Importer>TextureImporter</Importer> 
     44      <Processor>TextureProcessor</Processor> 
     45      <Options>None</Options> 
     46      <Output>C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\hahmo2.xnb</Output> 
     47      <Time>2016-07-07T13:02:37.6155974+03:00</Time> 
    3048    </Item> 
    3149    <BuildSuccessful>true</BuildSuccessful> 
  • 2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/obj/x86/Debug/FastestGunInTown.csproj.FileListAbsolute.txt

    r7902 r7973  
    1010C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\revolveri.xnb 
    1111C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\ammus.xnb 
     12C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\PelinKentta.xnb 
     13C:\MyTemp\SanteriK\FastestGunInTown\FastestGunInTown\FastestGunInTown\bin\x86\Debug\Content\hahmo2.xnb 
  • 2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTown/obj/x86/Debug/cachefile-{1322E6E4-46B9-4B14-9148-224F2875B658}-targetpath.txt

    r7902 r7973  
    22Content\revolveri.xnb 
    33Content\ammus.xnb 
     4Content\PelinKentta.xnb 
     5Content\hahmo2.xnb 
  • 2015/koodauskerho/SanteriK/FastestGunInTown/FastestGunInTown/FastestGunInTownContent/FastestGunInTownContent.contentproj

    r7902 r7973  
    6666    </Compile> 
    6767  </ItemGroup> 
     68  <ItemGroup> 
     69    <Compile Include="PelinKentta.png"> 
     70      <Name>PelinKentta</Name> 
     71      <Importer>TextureImporter</Importer> 
     72      <Processor>TextureProcessor</Processor> 
     73    </Compile> 
     74  </ItemGroup> 
     75  <ItemGroup> 
     76    <Compile Include="hahmo2.png"> 
     77      <Name>hahmo2</Name> 
     78      <Importer>TextureImporter</Importer> 
     79      <Processor>TextureProcessor</Processor> 
     80    </Compile> 
     81  </ItemGroup> 
    6882  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6983  <!--  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.