Changeset 6905 for 2015/30/OonaH


Ignore:
Timestamp:
2015-07-22 11:44:51 (4 years ago)
Author:
oomahutt
Message:
 
Location:
2015/30/OonaH
Files:
34 added
19 edited

Legend:

Unmodified
Added
Removed
  • 2015/30/OonaH/Aurinkomyrsky/Aurinkomyrsky/Aurinkomyrsky/Aurinkomyrsky.cs

    r6869 r6905  
    1212 
    1313    PlatformCharacter pelaaja1; 
    14  
    15     Image pelaajanKuva = LoadImage("alus"); 
     14    IntMeter pisteLaskuri; 
     15 
     16    Image pelaajanKuva = LoadImage("alus4"); 
    1617    Image tahtiKuva = LoadImage("tahti"); 
    1718    Image avaruus = LoadImage("avaruus"); 
     
    2930    SoundEffect maaliAani = LoadSoundEffect("maali"); 
    3031 
     32    EasyHighScore topLista = new EasyHighScore(); 
     33 
    3134    public override void Begin() 
    3235    { 
     36        MultiSelectWindow alkuValikko = new MultiSelectWindow("Pelin Alkuvalikko", "Aloita Peli", "Parhaat Pisteet", "Lopeta"); 
     37        Add(alkuValikko); 
     38 
     39        alkuValikko.AddItemHandler(0, Aloita); 
     40        //alkuValikko.AddItemHandler(1, ParhaatPisteet); 
     41        //alkuValikko.AddItemHandler(2, Exit); 
     42 
     43    } 
     44 
     45    void Aloita() 
     46    { 
    3347        LuoKentta(); 
     48        LuoLaskuri(); 
    3449        LisaaNappaimet(); 
     50 
    3551 
    3652        Camera.Follow(pelaaja1); 
     
    3955    } 
    4056 
     57    void AloitaPeli(Window sender) 
     58    { 
     59        Aloita(); 
     60    } 
     61     
    4162    void LuoKentta() 
    4263    { 
     
    4768        kentta.SetTileMethod('a', LisaaAukko); 
    4869        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
     70 
    4971        Level.CreateBorders(); 
    5072        Level.Background.Image = avaruus; 
     
    5274        Level.Background.TextureWrapSize = new Vector(3, 1); 
    5375 
    54         SetWindowSize(1700, 500); 
    55  
    56         PhysicsObject aurinko = new PhysicsObject(50,500); 
     76        PhysicsObject aurinko = PhysicsObject.CreateStaticObject(50,500); 
    5777        aurinko.Image = myrskynKuva; 
    5878        aurinko.X = Level.Left; 
     79        aurinko.Velocity = new Vector(10, 0); 
    5980        aurinko.Tag = "aurinko"; 
    6081        Add(aurinko); 
    6182 
    62         PhysicsObject planeetta = new PhysicsObject(100, 500); 
     83        PhysicsObject planeetta = PhysicsObject.CreateStaticObject(100, 500); 
    6384        planeetta.Image = planeettaKuva; 
    6485        planeetta.X = Level.Right; 
     
    6687        Add(planeetta); 
    6788 
    68         PhysicsObject lippu = new PhysicsObject(50, 30); 
     89        PhysicsObject lippu = PhysicsObject.CreateStaticObject(50, 30); 
    6990        lippu.Image = lipunKuva; 
    7091        lippu.Tag = "lippu"; 
    7192        lippu.X = Level.Right - 75; 
    7293        Add(lippu); 
    73          
    74     } 
     94 
     95        Timer kameraAjastin = new Timer(); 
     96        kameraAjastin.Interval = 0.1; 
     97        kameraAjastin.Timeout += KameranSiirto; 
     98        kameraAjastin.Start(); 
     99    } 
     100 
     101    void KameranSiirto() 
     102    { 
     103        Camera.StopFollowing(); 
     104        Camera.X += 1; 
     105    } 
     106 
    75107 
    76108    void LisaaTaso(Vector paikka, double leveys, double korkeus) 
     
    94126    void LisaaPelaaja(Vector paikka, double leveys, double korkeus) 
    95127    { 
    96         pelaaja1 = new PlatformCharacter(leveys -5, korkeus -5); 
     128        pelaaja1 = new PlatformCharacter(leveys -3, korkeus -1); 
    97129        pelaaja1.Position = paikka; 
    98130        pelaaja1.Image = pelaajanKuva; 
    99131        AddCollisionHandler(pelaaja1, "tahti", TormaaTahteen); 
    100         AddCollisionHandler(pelaaja1, "aurinko", CollisionHandler.ExplodeObject(2000, true)); 
     132        AddCollisionHandler(pelaaja1, "aukko", TormaaMustaanAukkoon); 
     133        AddCollisionHandler(pelaaja1, "aurinko", TormaaAurinkoon); 
    101134        Add(pelaaja1); 
     135    } 
     136 
     137    void TormaaMustaanAukkoon(PhysicsObject hahmo, PhysicsObject aukko) 
     138    { 
     139        Explosion rajahdys = new Explosion(3000); 
     140        rajahdys.Position = pelaaja1.Position; 
     141        rajahdys.Image = aukkoKuva; 
     142        Add(rajahdys); 
     143        pelaaja1.Destroy(); 
     144        PelaajaKuoli(); 
     145    } 
     146 
     147    void TormaaAurinkoon(PhysicsObject hahmo, PhysicsObject aukko) 
     148    { 
     149        Explosion rajahdys = new Explosion(3000); 
     150        rajahdys.Position = pelaaja1.Position; 
     151        Add(rajahdys); 
     152        pelaaja1.Destroy(); 
     153        PelaajaKuoli(); 
     154    } 
     155 
     156    void PelaajaKuoli() 
     157    { 
     158        topLista.EnterAndShow(pisteLaskuri.Value); 
     159        topLista.HighScoreWindow.Closed += AloitaPeli; 
    102160    } 
    103161 
     
    126184    { 
    127185        alus.Velocity = nopeus; 
     186        alus.Angle = nopeus.Angle; 
    128187    } 
    129188 
     
    131190    { 
    132191        maaliAani.Play(); 
    133         MessageDisplay.Add("Keräsit tähden!"); 
    134192        tahti.Destroy(); 
    135     } 
    136  
    137     void Havio(PhysicsObject hahmo, PhysicsObject aurinko) 
    138     { 
    139  
     193        pisteLaskuri.Value += 100; 
     194    } 
     195 
     196    void LuoLaskuri() 
     197    { 
     198        pisteLaskuri = new IntMeter(0); 
     199 
     200        Label pisteNaytto = new Label(); 
     201        pisteNaytto.X -= (Window.Width/2-200); 
     202        pisteNaytto.Y += (Window.Height/2-50); 
    140203         
     204        pisteNaytto.TextColor = Color.White; 
     205        pisteNaytto.Color = Color.Transparent; 
     206        pisteNaytto.BindTo(pisteLaskuri); 
     207        pisteNaytto.IntFormatString = "Pisteitä: {0:D1}"; 
     208 
     209        Add(pisteNaytto); 
    141210    } 
    142211} 
  • 2015/30/OonaH/Aurinkomyrsky/Aurinkomyrsky/Aurinkomyrsky/Aurinkomyrsky.csproj.Debug.cachefile

    r6869 r6905  
    1010Content\lippu.xnb 
    1111Content\myrsky2.xnb 
     12Content\alus4.xnb 
     13Content\alus5.xnb 
     14Content\alus6.xnb 
     15Content\alus7.xnb 
     16Content\aukko3.xnb 
  • 2015/30/OonaH/Aurinkomyrsky/Aurinkomyrsky/Aurinkomyrsky/obj/x86/Debug/Aurinkomyrsky.csproj.FileListAbsolute.txt

    r6869 r6905  
    1818C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\lippu.xnb 
    1919C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\myrsky2.xnb 
     20C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus4.xnb 
     21C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus5.xnb 
     22C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus6.xnb 
     23C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus7.xnb 
     24C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\aukko3.xnb 
  • 2015/30/OonaH/Aurinkomyrsky/Aurinkomyrsky/Aurinkomyrsky/obj/x86/Debug/cachefile-{95D20900-7005-425A-A0CD-AA83EC175105}-targetpath.txt

    r6869 r6905  
    1010Content\lippu.xnb 
    1111Content\myrsky2.xnb 
     12Content\alus4.xnb 
     13Content\alus5.xnb 
     14Content\alus6.xnb 
     15Content\alus7.xnb 
     16Content\aukko3.xnb 
  • 2015/30/OonaH/Aurinkomyrsky/Aurinkomyrsky/AurinkomyrskyContent/AurinkomyrskyContent.contentproj

    r6869 r6905  
    120120    </Compile> 
    121121  </ItemGroup> 
     122  <ItemGroup> 
     123    <Compile Include="alus4.png"> 
     124      <Name>alus4</Name> 
     125      <Importer>TextureImporter</Importer> 
     126      <Processor>TextureProcessor</Processor> 
     127    </Compile> 
     128  </ItemGroup> 
     129  <ItemGroup> 
     130    <Compile Include="alus5.png"> 
     131      <Name>alus5</Name> 
     132      <Importer>TextureImporter</Importer> 
     133      <Processor>TextureProcessor</Processor> 
     134    </Compile> 
     135    <Compile Include="alus6.png"> 
     136      <Name>alus6</Name> 
     137      <Importer>TextureImporter</Importer> 
     138      <Processor>TextureProcessor</Processor> 
     139    </Compile> 
     140    <Compile Include="alus7.png"> 
     141      <Name>alus7</Name> 
     142      <Importer>TextureImporter</Importer> 
     143      <Processor>TextureProcessor</Processor> 
     144    </Compile> 
     145  </ItemGroup> 
     146  <ItemGroup> 
     147    <Compile Include="aukko3.png"> 
     148      <Name>aukko3</Name> 
     149      <Importer>TextureImporter</Importer> 
     150      <Processor>TextureProcessor</Processor> 
     151    </Compile> 
     152  </ItemGroup> 
    122153  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    123154  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2015/30/OonaH/Aurinkomyrsky/Aurinkomyrsky/AurinkomyrskyContent/kentta1.txt

    r6869 r6905  
    1 ....###########################################################################################################................ 
    2 ...##.....#...*#.......#.....#....#############...a##*.........###..........*#############..................................... 
    3 ......#.#.#.#.##.####.####.#...#....#........a#.#####.########.###.#########.#...........#.####################................ 
    4 ...##.#.#...#.#.....#.#a.#.########.#.#.#######.##a##.#......#.###.##...####.#####.#####.#.#####.......########................ 
    5 ....#.#.#####...###.#.##.#........#...#.........##.##.#.####.#......#.#..###.#.....#....*#.#####.#####.#....###................ 
    6 ...##.#...#a..###...#..#.#.######.###.#########.##.##.#.#a...########.####...#####.#.#####.......##*##.#.##.###................ 
    7 ....#.#.#.#######.####.#.#......#*............#.##.##.#.####.#...........#.####....#....a##########.##.#.##.###................ 
    8 ..A##.#.#.#.....#....###.######.#############.#.##.##.#.#....#.###########....#.#.#################.##.#.##.###................ 
    9 .....*#.....#.####.###...#*...#.#a......#####.#.##.##.#.#*####...........####.#.#....#a*****.............##*###................ 
    10 ...##########...a#.#...#.#.##.#.#######.#.....#....##.#.#......#########....#...####.######################.###................ 
    11 .......#...#######.#.#####..#...#.......#.###########.#.######....###########.#......#######................###................ 
    12 ...###.#.#.#...#...#.#...##.#####.#######.#...........#.#a..###.#####...#...#.######.###.#.#.##################................ 
    13 ....#....#...#.#a###*#.#..#.#..*#....#....#.#.#########.###...#.#...#.#.#.#.#.#........#.#.#................###................ 
    14 ...##.##.##.######...#.##...#.#.####.#.####.#.#....####...###.#.#.#.#.#.#.#.#.#.######.#...################.###................ 
    15 ......#..a#*.......#..*####...#......#......#...##......#.....#...#...#...#...#.....##*..#*.................###................ 
    16 ...############################################################################################################................ 
     1......................###########################################################################################################................ 
     2.....................##.....#...*#.......#.....#....#############...a##*.........###..........*#############..................................... 
     3........................#.#.#.#.##.####.####.#...#....#........a#.#####.########.###.#########.#...........#.####################................ 
     4.....................##.#.#...#.#.....#.#a.#.########.#.#.#######.##a##.#......#.###.##...####.#####.#####.#.#####.......########................ 
     5......................#.#.#####...###.#.##.#........#...#.........##.##.#.####.#......#.#..###.#.....#....*#.#####.#####.#....###................ 
     6.....................##.#...#a..###...#..#.#.######.###.#########.##.##.#.#a...########.####...#####.#.#####.......##*##.#.##.###................ 
     7......................#.#.#.#######.####.#.#......#*............#.##.##.#.####.#...........#.####....#....a##########.##.#.##.###................ 
     8....A................##.#.#.#.....#....###.######.#############.#.##.##.#.#....#.###########....#.#.#################.##.#.##.###................ 
     9.......................*#.....#.####.###...#*...#.#a......#####.#.##.##.#.#*####...........####.#.#....#a*****.............##*###................ 
     10.....................##########...a#.#...#.#.##.#.#######.#.....#....##.#.#......#########....#...####.######################.###................ 
     11.........................#...#######.#.#####..#...#.......#.###########.#.######....###########.#......#######................###................ 
     12.....................###.#.#.#...#...#.#...##.#####.#######.#...........#.#a..###.#####...#...#.######.###.#.#.##################................ 
     13......................#....#...#.#a###*#.#..#.#..*#....#....#.#.#########.###...#.#...#.#.#.#.#.#........#.#.#................###................ 
     14.....................##.##.##.######...#.##...#.#.####.#.####.#.#....####...###.#.#.#.#.#.#.#.#.#.######.#...################.###................ 
     15........................#..a#*.......#..*####...#......#......#...##......#.....#...#...#...#...#.....##*..#*.................###................ 
     16.....................############################################################################################################................ 
  • 2015/30/OonaH/Aurinkomyrsky/Aurinkomyrsky/AurinkomyrskyContent/obj/x86/Debug/ContentPipeline.xml

    r6869 r6905  
    2727      <Options>None</Options> 
    2828      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\kentta1.xnb</Output> 
    29       <Time>2015-07-21T14:48:37.1526506+03:00</Time> 
     29      <Time>2015-07-22T11:05:50.6279851+03:00</Time> 
    3030    </Item> 
    3131    <Item> 
     
    4545      <Options>None</Options> 
    4646      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus.xnb</Output> 
    47       <Time>2015-07-21T09:54:29.324499+03:00</Time> 
     47      <Time>2015-07-22T10:49:20.2306762+03:00</Time> 
    4848    </Item> 
    4949    <Item> 
     
    6363      <Options>None</Options> 
    6464      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\aukko2.xnb</Output> 
    65       <Time>2015-07-21T13:32:27.1656064+03:00</Time> 
     65      <Time>2015-07-22T11:34:34.7812318+03:00</Time> 
    6666    </Item> 
    6767    <Item> 
     
    100100      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\myrsky2.xnb</Output> 
    101101      <Time>2015-07-21T14:52:10.0654506+03:00</Time> 
     102    </Item> 
     103    <Item> 
     104      <Source>alus4.png</Source> 
     105      <Name>alus4</Name> 
     106      <Importer>TextureImporter</Importer> 
     107      <Processor>TextureProcessor</Processor> 
     108      <Options>None</Options> 
     109      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus4.xnb</Output> 
     110      <Time>2015-07-22T10:50:13.2620364+03:00</Time> 
     111    </Item> 
     112    <Item> 
     113      <Source>alus5.png</Source> 
     114      <Name>alus5</Name> 
     115      <Importer>TextureImporter</Importer> 
     116      <Processor>TextureProcessor</Processor> 
     117      <Options>None</Options> 
     118      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus5.xnb</Output> 
     119      <Time>2015-07-22T10:01:29.7668862+03:00</Time> 
     120    </Item> 
     121    <Item> 
     122      <Source>alus6.png</Source> 
     123      <Name>alus6</Name> 
     124      <Importer>TextureImporter</Importer> 
     125      <Processor>TextureProcessor</Processor> 
     126      <Options>None</Options> 
     127      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus6.xnb</Output> 
     128      <Time>2015-07-22T10:01:29.7668862+03:00</Time> 
     129    </Item> 
     130    <Item> 
     131      <Source>alus7.png</Source> 
     132      <Name>alus7</Name> 
     133      <Importer>TextureImporter</Importer> 
     134      <Processor>TextureProcessor</Processor> 
     135      <Options>None</Options> 
     136      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\alus7.xnb</Output> 
     137      <Time>2015-07-22T10:01:29.7668862+03:00</Time> 
     138    </Item> 
     139    <Item> 
     140      <Source>aukko3.png</Source> 
     141      <Name>aukko3</Name> 
     142      <Importer>TextureImporter</Importer> 
     143      <Processor>TextureProcessor</Processor> 
     144      <Options>None</Options> 
     145      <Output>C:\MyTemp\OonaH\Aurinkomyrsky\Aurinkomyrsky\Aurinkomyrsky\bin\x86\Debug\Content\aukko3.xnb</Output> 
     146      <Time>2015-07-22T11:34:34.7968318+03:00</Time> 
    102147    </Item> 
    103148    <BuildSuccessful>true</BuildSuccessful> 
Note: See TracChangeset for help on using the changeset viewer.