Changeset 7378 for 2016/24


Ignore:
Timestamp:
2016-06-16 14:48:43 (7 years ago)
Author:
karkaite
Message:
 
Location:
2016/24/JesseH/Cubes
Files:
5 added
11 edited

Legend:

Unmodified
Added
Removed
  • 2016/24/JesseH/Cubes/Cubes/Cubes/Cubes.cs

    r7341 r7378  
    1414 
    1515    List<Hahmo> pelaajat = new List<Hahmo>(); 
     16    GameObject maski; 
    1617    int aktiivinenPelaaja = 0; 
    1718    Image fredKuva = LoadImage("Fred"); 
     
    2223    Image VasenKuva = LoadImage("Vasen"); 
    2324    Image OikeaKuva = LoadImage("Oikea"); 
     25    Image maskiKuva = LoadImage("maski"); 
    2426    IntMeter pelaajiaMaalissa; 
    2527 
     
    2729 
    2830    public override void Begin() 
     31    { 
     32        ClearAll(); 
     33 
     34        MultiSelectWindow alkuValikko = new MultiSelectWindow("Cubes", 
     35"Aloitapeli", "PelinOhjeet", "Exit"); 
     36        Add(alkuValikko); 
     37 
     38        alkuValikko.AddItemHandler(0, AloitaPeli); 
     39        alkuValikko.AddItemHandler(1, PelinOhjeet); 
     40        alkuValikko.AddItemHandler(2, Exit); 
     41        Level.Background.CreateGradient(Color.DarkGray, Color.Black); 
     42    } 
     43     
     44    void PelinOhjeet() 
     45    { 
     46        ClearAll(); 
     47        IsMouseVisible = true; 
     48        Label tekstikentta = new Label("Käytä Toisia Palikoita apuna. Vaihda pelaajaa Alt Näppäimestä"); 
     49        Add(tekstikentta); 
     50        GameObject nappula = new GameObject(LoadImage("Nappula")); 
     51        nappula.Position = new Vector(0, -100); 
     52        Add(nappula); 
     53        Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Klikkaus, null, nappula); 
     54        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Begin, "Palaa valikkoon"); 
     55     
     56 
     57    } 
     58 
     59    void Klikkaus(GameObject nappula) 
     60    { 
     61        if (Mouse.IsCursorOn(nappula)) Begin(); 
     62    } 
     63 
     64     
     65    void AloitaPeli() 
    2966    { 
    3067        Gravity = new Vector(0, -1000); 
     
    3774        Camera.StayInLevel = true; 
    3875    } 
    39  
    4076    void LuoKentta() 
    4177    { 
     
    5086        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    5187        Level.CreateBorders(); 
    52         Level.Background.CreateGradient(Color.LightGray, Color.Gray); 
     88        Level.Background.CreateGradient( Color.DarkGray, Color.Black); 
     89 
     90 
     91        maski = new GameObject(1600, 1600); 
     92        maski.Image = this.maskiKuva; 
     93        pelaajat[aktiivinenPelaaja].Add(maski); 
     94         
    5395    } 
    5496 
     
    87129        pelaaja.Image = kuva; 
    88130        pelaaja.Tag = nimi; 
    89         AddCollisionHandler(pelaaja, "Ovi", TormaaTahteen); 
     131        AddCollisionHandler(pelaaja, "Ovi", TormaaMaaliin); 
    90132        AddCollisionHandler(pelaaja, "Avain", TormaaAvaimeen); 
    91133        Add(pelaaja); 
    92134        pelaajat.Add(pelaaja); 
    93135        pelaaja.Hyppynopeus = hyppyNopeus; 
     136 
    94137    } 
    95138 
     
    127170    void VaihdaPelaajaa() 
    128171    { 
     172        pelaajat[aktiivinenPelaaja].Remove(maski); 
    129173        aktiivinenPelaaja++; 
    130174        if (aktiivinenPelaaja > pelaajat.Count - 1) 
     
    133177        } 
    134178        Camera.Follow(pelaajat[aktiivinenPelaaja]); 
     179         
     180        pelaajat[aktiivinenPelaaja].Add(maski); 
    135181    } 
    136182    void Liikuta(double nopeus) 
     
    144190    } 
    145191 
    146     void TormaaTahteen(PhysicsObject hahmo, PhysicsObject tahti) 
    147     { 
    148  
     192    void TormaaMaaliin(PhysicsObject hahmo, PhysicsObject tahti) 
     193    { 
     194        if (pelaajat[aktiivinenPelaaja].Equals(hahmo)) 
     195        { 
     196            pelaajat.Remove(pelaajat[aktiivinenPelaaja]); 
     197            VaihdaPelaajaa(); 
     198        } 
     199        else 
     200        { 
     201            for (int i = 0; i < pelaajat.Count-1; i++) 
     202            { 
     203                if (pelaajat[i].Equals(hahmo)) pelaajat.Remove(pelaajat[i]); 
     204            } 
     205        } 
    149206        hahmo.Destroy(); 
    150207        pelaajiaMaalissa.Value++; 
  • 2016/24/JesseH/Cubes/Cubes/Cubes/Cubes.csproj.Debug.cachefile

    r7341 r7378  
    88Content\Oikea.xnb 
    99Content\avain.xnb 
     10Content\Nappula.xnb 
     11Content\maski.xnb 
  • 2016/24/JesseH/Cubes/Cubes/Cubes/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r7341 r7378  
    8383      <Time>2016-06-15T10:28:43.0060156+03:00</Time> 
    8484    </Item> 
     85    <Item> 
     86      <Source>Nappula.png</Source> 
     87      <Name>Nappula</Name> 
     88      <Importer>TextureImporter</Importer> 
     89      <Processor>TextureProcessor</Processor> 
     90      <Options>None</Options> 
     91      <Output>C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\Nappula.xnb</Output> 
     92      <Time>2016-06-16T10:48:03.5433101+03:00</Time> 
     93    </Item> 
     94    <Item> 
     95      <Source>maski.png</Source> 
     96      <Name>maski</Name> 
     97      <Importer>TextureImporter</Importer> 
     98      <Processor>TextureProcessor</Processor> 
     99      <Options>None</Options> 
     100      <Output>C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\maski.xnb</Output> 
     101      <Time>2016-06-16T11:15:36.0162101+03:00</Time> 
     102    </Item> 
    85103    <BuildSuccessful>true</BuildSuccessful> 
    86104    <Settings> 
  • 2016/24/JesseH/Cubes/Cubes/Cubes/obj/x86/Debug/Cubes.csproj.FileListAbsolute.txt

    r7341 r7378  
    1616C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\Oikea.xnb 
    1717C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\avain.xnb 
     18C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\Nappula.xnb 
     19C:\MyTemp\JesseH\Cubes\Cubes\Cubes\bin\x86\Debug\Content\maski.xnb 
  • 2016/24/JesseH/Cubes/Cubes/Cubes/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r7341 r7378  
    88Content\Oikea.xnb 
    99Content\avain.xnb 
     10Content\Nappula.xnb 
     11Content\maski.xnb 
  • 2016/24/JesseH/Cubes/Cubes/CubesContent/CubesContent.contentproj

    r7341 r7378  
    113113    </Compile> 
    114114  </ItemGroup> 
     115  <ItemGroup> 
     116    <Compile Include="Nappula.png"> 
     117      <Name>Nappula</Name> 
     118      <Importer>TextureImporter</Importer> 
     119      <Processor>TextureProcessor</Processor> 
     120    </Compile> 
     121  </ItemGroup> 
     122  <ItemGroup> 
     123    <Compile Include="maski.png"> 
     124      <Name>maski</Name> 
     125      <Importer>TextureImporter</Importer> 
     126      <Processor>TextureProcessor</Processor> 
     127    </Compile> 
     128  </ItemGroup> 
    115129  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    116130  <!--  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.