Changeset 5978 for 2015/24


Ignore:
Timestamp:
2015-06-10 11:31:44 (8 years ago)
Author:
laaljoso
Message:
 
Location:
2015/24/AleksiS
Files:
7 added
1 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • 2015/24/AleksiS/CandyLand/CandyLand/CandyLand/CandyLand.cs

    r5955 r5978  
    1414 
    1515    PlatformCharacter pelaaja1; 
     16    PlatformCharacter vihollinen; 
    1617 
    1718    Image pelaajanKuva = LoadImage("tikku-ukko"); 
    18     Image tahtiKuva = LoadImage("tahti"); 
     19    Image KarkinKuva = LoadImage("YellowCandy"); 
     20    Image vihollisenKuva = LoadImage("CandyThief"); 
    1921 
    2022    SoundEffect maaliAani = LoadSoundEffect("maali"); 
     23    Label pisteNaytto; 
    2124 
    2225    public override void Begin() 
    2326    { 
     27        MultiSelectWindow alkuValikko = new MultiSelectWindow("Candy Land", "Pelaa!", "Lopeta"); 
     28        Add(alkuValikko); 
     29 
     30        ClearAll(); 
    2431        Gravity = new Vector(0, -1000); 
     32 
     33        LuoPisteLaskuri(); 
    2534 
    2635        LuoKentta(); 
     
    3847        kentta.SetTileMethod('*', LisaaTahti); 
    3948        kentta.SetTileMethod('N', LisaaPelaaja); 
     49        kentta.SetTileMethod('V', LisaaVihollinen); 
    4050        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    4151        Level.CreateBorders(); 
    4252        Level.Background.CreateGradient(Color.White, Color.SkyBlue); 
    4353    } 
     54     
     55    IntMeter pisteLaskuri; 
    4456 
     57    void LuoPisteLaskuri() 
     58    { 
     59        pisteLaskuri = new IntMeter(0,0,0); 
     60 
     61        pisteNaytto = new Label(); 
     62        pisteNaytto.X = Screen.Left + 150; 
     63        pisteNaytto.Y = Screen.Top - 100; 
     64        pisteNaytto.TextColor = Color.Black; 
     65        pisteNaytto.Color = Color.White; 
     66        pisteNaytto.Title = "Karkit"; 
     67         
     68 
     69 
     70        pisteNaytto.BindTo(pisteLaskuri); 
     71        Add(pisteNaytto); 
     72 
     73    } 
    4574    void LisaaTaso(Vector paikka, double leveys, double korkeus) 
    4675    { 
     
    5685        tahti.IgnoresCollisionResponse = true; 
    5786        tahti.Position = paikka; 
    58         tahti.Image = tahtiKuva; 
     87        tahti.Image = KarkinKuva; 
    5988        tahti.Tag = "tahti"; 
    6089        Add(tahti); 
     90        pisteLaskuri.MaxValue++; 
     91        pisteNaytto.IntFormatString = " {0:D1}/" + pisteLaskuri.MaxValue; 
    6192    } 
    6293 
     
    6798        pelaaja1.Mass = 4.0; 
    6899        pelaaja1.Image = pelaajanKuva; 
    69         AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 
     100        pelaaja1.Tag = "pelaaja"; 
     101        AddCollisionHandler(pelaaja1, "tahti", KeraaKarkki); 
     102        AddCollisionHandler(pelaaja1, "vihollinen", delegate(PhysicsObject A, PhysicsObject B) 
     103        { 
     104            Begin(); 
     105        }); 
    70106        Add(pelaaja1); 
     107 
     108    } 
     109 
     110    void LisaaVihollinen(Vector paikka, double leveys, double korkeus) 
     111    { 
     112        vihollinen = new PlatformCharacter(leveys, korkeus); 
     113        vihollinen.Position = paikka; 
     114        vihollinen.Mass = 4.0; 
     115        vihollinen.Image = vihollisenKuva; 
     116        vihollinen.Shape = Shape.FromImage(vihollisenKuva); 
     117        vihollinen.Tag = "vihollinen"; 
     118        vihollinen.IgnoresGravity = true; 
     119        Add(vihollinen); 
     120 
     121        FollowerBrain aivot = new FollowerBrain("pelaaja"); 
     122        vihollinen.Brain = aivot; 
     123         
    71124    } 
    72125 
     
    74127    { 
    75128        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 
     129        Keyboard.Listen(Key.P, ButtonState.Pressed, TauotaPeli, "Tauko"); 
    76130        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    77131 
     
    88142        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    89143    } 
     144    void TauotaPeli() 
     145    { 
     146        MessageDisplay.Add("Peli tauolla"); 
     147        Pause(); 
     148    } 
    90149 
    91150    void Liikuta(PlatformCharacter hahmo, double nopeus) 
     
    99158    } 
    100159 
    101     void TormaaTahteen(PhysicsObject hahmo, PhysicsObject tahti) 
     160    void KeraaKarkki(PhysicsObject hahmo, PhysicsObject tahti) 
    102161    { 
    103162        maaliAani.Play(); 
    104         MessageDisplay.Add("Keräsit tähden!"); 
     163        MessageDisplay.Add("Keräsit karkin!"); 
    105164        tahti.Destroy(); 
     165        pisteLaskuri.Value += 1; 
     166 
    106167    } 
    107168} 
  • 2015/24/AleksiS/CandyLand/CandyLand/CandyLand/CandyLand.csproj.Debug.cachefile

    r5955 r5978  
    11Content\maali.xnb 
    2 Content\tahti.xnb 
    32Content\kentta1.xnb 
    43Content\tikku-ukko.xnb 
     4Content\YellowCandy.xnb 
     5Content\CandyThief.xnb 
  • 2015/24/AleksiS/CandyLand/CandyLand/CandyLand/obj/x86/Debug/CandyLand.csproj.FileListAbsolute.txt

    r5955 r5978  
    11C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\maali.xnb 
    2 C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\tahti.xnb 
    32C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\kentta1.xnb 
    43C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\CandyLand.exe 
     
    1110C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\obj\x86\Debug\CandyLand.csprojResolveAssemblyReference.cache 
    1211C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\tikku-ukko.xnb 
     12C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\YellowCandy.xnb 
     13C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\CandyThief.xnb 
  • 2015/24/AleksiS/CandyLand/CandyLand/CandyLand/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r5955 r5978  
    1212    </Item> 
    1313    <Item> 
    14       <Source>tahti.png</Source> 
    15       <Name>tahti</Name> 
    16       <Importer>TextureImporter</Importer> 
    17       <Processor>TextureProcessor</Processor> 
    18       <Options>None</Options> 
    19       <Output>C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\tahti.xnb</Output> 
    20       <Time>2015-06-09T13:56:14.7626493+03:00</Time> 
    21     </Item> 
    22     <Item> 
    2314      <Source>kentta1.txt</Source> 
    2415      <Name>kentta1</Name> 
     
    2718      <Options>None</Options> 
    2819      <Output>C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\kentta1.xnb</Output> 
    29       <Time>2015-06-09T14:01:34.2330493+03:00</Time> 
     20      <Time>2015-06-10T10:48:06.2998651+03:00</Time> 
    3021    </Item> 
    3122    <Item> 
     
    3728      <Output>C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\tikku-ukko.xnb</Output> 
    3829      <Time>2015-06-09T14:51:37.4592493+03:00</Time> 
     30    </Item> 
     31    <Item> 
     32      <Source>YellowCandy.png</Source> 
     33      <Name>YellowCandy</Name> 
     34      <Importer>TextureImporter</Importer> 
     35      <Processor>TextureProcessor</Processor> 
     36      <Options>None</Options> 
     37      <Output>C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\YellowCandy.xnb</Output> 
     38      <Time>2015-06-10T09:49:12.7256651+03:00</Time> 
     39    </Item> 
     40    <Item> 
     41      <Source>CandyThief.png</Source> 
     42      <Name>CandyThief</Name> 
     43      <Importer>TextureImporter</Importer> 
     44      <Processor>TextureProcessor</Processor> 
     45      <Options>None</Options> 
     46      <Output>C:\MyTemp\AleksiS\CandyLand\CandyLand\CandyLand\bin\x86\Debug\Content\CandyThief.xnb</Output> 
     47      <Time>2015-06-10T10:59:51.4680651+03:00</Time> 
    3948    </Item> 
    4049    <BuildSuccessful>true</BuildSuccessful> 
  • 2015/24/AleksiS/CandyLand/CandyLand/CandyLand/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r5955 r5978  
    11Content\maali.xnb 
    2 Content\tahti.xnb 
    32Content\kentta1.xnb 
    43Content\tikku-ukko.xnb 
     4Content\YellowCandy.xnb 
     5Content\CandyThief.xnb 
  • 2015/24/AleksiS/CandyLand/CandyLand/CandyLandContent/CandyLandContent.contentproj

    r5956 r5978  
    4646  </ItemGroup> 
    4747  <ItemGroup> 
     48    <Compile Include="CandyThief.png"> 
     49      <Name>CandyThief</Name> 
     50      <Importer>TextureImporter</Importer> 
     51      <Processor>TextureProcessor</Processor> 
     52    </Compile> 
    4853    <Compile Include="maali.wav"> 
    4954      <Name>maali</Name> 
     
    6469    </Compile> 
    6570  </ItemGroup> 
     71  <ItemGroup> 
     72    <Compile Include="YellowCandy.png"> 
     73      <Name>YellowCandy</Name> 
     74      <Importer>TextureImporter</Importer> 
     75      <Processor>TextureProcessor</Processor> 
     76    </Compile> 
     77  </ItemGroup> 
    6678  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6779  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2015/24/AleksiS/CandyLand/CandyLand/CandyLandContent/kentta1.txt

    r5955 r5978  
    1111...##..##..##..##..... 
    1212...................... 
    13 .*....*.......*...*... 
    14 .##..##..##..##..##... 
     13.*....*...V.*...*..... 
     14.##..##..#####..##.... 
    1515...................... 
    1616........N............. 
Note: See TracChangeset for help on using the changeset viewer.