Changeset 8990


Ignore:
Timestamp:
2017-07-07 11:15:43 (6 years ago)
Author:
npo17_42
Message:

peli valmis. Mietipä sitä.

Location:
2017/27/OskariK
Files:
13 added
11 edited

Legend:

Unmodified
Added
Removed
  • 2017/27/OskariK/OK/OK/OK/OK.cs

    r8966 r8990  
    2323    GameObject inventory; //ruutu, jossa kamasi näkyvät 
    2424 
     25    bool potionmeni = false; 
     26    bool pommimeni = false; 
     27 
    2528    GameObject transition; //ruutu, jolla peli menee eteenpäin 
    2629    GameObject voitto; //ruutu, joka tulee kun voitat pelin 
     
    6669    void LuoAlue() 
    6770    { 
    68  
    6971        Level.Background.Color = Color.White; 
    7072 
     
    9799        portrait.X = 750.00; 
    98100        portrait.Y = -330.00; 
     101        portrait.Image = LoadImage("Portretti"); 
    99102        Add(portrait); 
    100103 
     
    134137 
    135138        HP = new IntMeter(65); 
     139        HP.MaxValue = 65; 
    136140 
    137141        Label playerHP = new Label(); 
     
    166170    void Kontrollit() 
    167171    { 
     172        Keyboard.Clear(); 
    168173        Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); 
    169174        //Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); 
     
    192197    void Items() 
    193198    { 
     199 
    194200        pelaajatoiminut = false; 
    195         inventory = new GameObject (450.0, 300.0); 
     201        inventory = new GameObject(450.0, 300.0); 
    196202        command.Shape = Shape.Rectangle; 
    197203        inventory.Color = Color.Black; 
     
    199205        inventory.Y = -330.00; 
    200206        inventory.Image = LoadImage("Items"); 
    201         Add(inventory); 
    202         command.Destroy(); 
    203  
    204         Keyboard.Listen(Key.X, ButtonState.Pressed, LuoAlue, null); 
    205  
    206  
    207  
    208  
    209     } 
    210  
     207        Add(inventory, 1); 
     208 
     209        Keyboard.Clear(); 
     210        Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); 
     211        Keyboard.Listen(Key.Up, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusYlos); 
     212        Keyboard.Listen(Key.Z, ButtonState.Pressed, Itemvalitse, null); 
     213        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     214    } 
     215 
     216    void Itemvalitse() 
     217    { 
     218        if (Pointer.Y > command.Top - command.Height / 3) Potion(); 
     219        else if (Pointer.Y < command.Bottom + command.Height / 3) poistainventory(); 
     220        else Bomb(); 
     221    } 
     222 
     223    void poistainventory() 
     224 
     225    { 
     226        Kontrollit(); 
     227        inventory.Destroy(); 
     228    } 
     229 
     230 
     231    void Potion() 
     232    { 
     233        if (potionmeni) 
     234        { 
     235            PlaySound("eipysty"); 
     236            return; 
     237        } 
     238        potionmeni = true; 
     239 
     240        pelaajatoiminut = true; 
     241 
     242        HP.Value = HP.MaxValue; 
     243 
     244        feedtext.Y = textheight - feedtext.Height / 2; 
     245        feedtext.Text = "Potion recovers your HP. \n" + feedtext.Text; 
     246        PlaySound("potion"); 
     247        Kontrollit(); 
     248 
     249        switch (vihollisNro) 
     250        { 
     251            case 1: 
     252                if (goopHP > 0) Timer.SingleShot(1.0, Enemy1attack); 
     253                else Transition(); 
     254                break; 
     255 
     256            case 2: 
     257                if (skeleHP > 0) Timer.SingleShot(1.0, Enemy2attack); 
     258                else Transition2(); 
     259                break; 
     260 
     261            case 3: 
     262                if (snekHP > 0) Timer.SingleShot(1.0, Enemy3attack); 
     263                else Voitit(); 
     264                break; 
     265 
     266        } 
     267 
     268        poistainventory(); 
     269    } 
     270 
     271    void Bomb() 
     272    { 
     273        if (pommimeni) 
     274        { 
     275            PlaySound("eipysty"); 
     276            return; 
     277        } 
     278        pommimeni = true; 
     279 
     280        pelaajatoiminut = true; 
     281 
     282        poistainventory(); 
     283        pelaajatoiminut = true; 
     284 
     285        Explosion rajahdys = new Explosion(500); 
     286        rajahdys.Position = (foe1.Position); 
     287        Add(rajahdys, 3); 
     288 
     289        feedtext.Text = "The bomb explodes! \n" + feedtext.Text; 
     290        feedtext.Y = textheight - feedtext.Height / 2; 
     291 
     292        Timer.SingleShot (3.0, Bomb2); 
     293 
     294    } 
     295 
     296    void Bomb2() 
     297    { 
     298        switch (vihollisNro) 
     299        { 
     300            case 1: 
     301                goopHP.Value -= 20; 
     302                Transition(); 
     303 
     304                break; 
     305 
     306            case 2: 
     307                skeleHP.Value -= 40; 
     308                Transition2(); 
     309 
     310                break; 
     311 
     312            case 3: 
     313                snekHP.Value -= 100; 
     314                Voitit(); 
     315 
     316                break; 
     317        }; 
     318 
     319    } 
    211320    void Attack() //mitä tapahtuu jos painaa attackkia 
    212321    { 
     
    405514        transition.Y = 200.00; 
    406515        transition.Image = LoadImage("transiitio"); 
    407         Add(transition, 3); 
     516        Add(transition, 1); 
    408517 
    409518        Timer.SingleShot(1.5, Lisaapahis3); 
     
    446555        foe3.Y = 200.00; 
    447556        foe3.Image = LoadImage("snek"); 
    448         Add(foe3, 3); 
     557        Add(foe3, 2); 
    449558 
    450559        pelaajatoiminut = false; 
  • 2017/27/OskariK/OK/OK/OK/OK.csproj.Debug.cachefile

    r8966 r8990  
    1212Content\voitto.xnb 
    1313Content\items.xnb 
     14Content\Portretti.xnb 
     15Content\potion.xnb 
     16Content\eipysty.xnb 
  • 2017/27/OskariK/OK/OK/OK/obj/x86/Debug/ContentPipeline-{FF5F8A32-FAE3-40A4-9505-35D2B1C5DB01}.xml

    r8966 r8990  
    119119      <Time>2017-07-06T13:50:25.6205648+03:00</Time> 
    120120    </Item> 
     121    <Item> 
     122      <Source>Portretti.png</Source> 
     123      <Name>Portretti</Name> 
     124      <Importer>TextureImporter</Importer> 
     125      <Processor>TextureProcessor</Processor> 
     126      <Options>None</Options> 
     127      <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\Portretti.xnb</Output> 
     128      <Time>2017-07-07T10:07:09.1703683+03:00</Time> 
     129    </Item> 
     130    <Item> 
     131      <Source>potion.wav</Source> 
     132      <Name>potion</Name> 
     133      <Importer>WavImporter</Importer> 
     134      <Processor>SoundEffectProcessor</Processor> 
     135      <Options>None</Options> 
     136      <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\potion.xnb</Output> 
     137      <Time>2017-07-07T10:50:40.0251925+03:00</Time> 
     138    </Item> 
     139    <Item> 
     140      <Source>eipysty.wav</Source> 
     141      <Name>eipysty</Name> 
     142      <Importer>WavImporter</Importer> 
     143      <Processor>SoundEffectProcessor</Processor> 
     144      <Options>None</Options> 
     145      <Output>C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\eipysty.xnb</Output> 
     146      <Time>2017-07-07T11:11:19.75973+03:00</Time> 
     147    </Item> 
    121148    <BuildSuccessful>true</BuildSuccessful> 
    122149    <Settings> 
  • 2017/27/OskariK/OK/OK/OK/obj/x86/Debug/OK.csproj.FileListAbsolute.txt

    r8966 r8990  
    2020C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\voitto.xnb 
    2121C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\items.xnb 
     22C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\Portretti.xnb 
     23C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\potion.xnb 
     24C:\MyTemp\OskariK\OK\OK\OK\bin\x86\Debug\Content\eipysty.xnb 
  • 2017/27/OskariK/OK/OK/OK/obj/x86/Debug/cachefile-{FF5F8A32-FAE3-40A4-9505-35D2B1C5DB01}-targetpath.txt

    r8966 r8990  
    1212Content\voitto.xnb 
    1313Content\items.xnb 
     14Content\Portretti.xnb 
     15Content\potion.xnb 
     16Content\eipysty.xnb 
  • 2017/27/OskariK/OK/OK/OKContent/OKContent.contentproj

    r8966 r8990  
    137137    </Compile> 
    138138  </ItemGroup> 
     139  <ItemGroup> 
     140    <Compile Include="Portretti.png"> 
     141      <Name>Portretti</Name> 
     142      <Importer>TextureImporter</Importer> 
     143      <Processor>TextureProcessor</Processor> 
     144    </Compile> 
     145  </ItemGroup> 
     146  <ItemGroup> 
     147    <Compile Include="potion.wav"> 
     148      <Name>potion</Name> 
     149      <Importer>WavImporter</Importer> 
     150      <Processor>SoundEffectProcessor</Processor> 
     151    </Compile> 
     152  </ItemGroup> 
     153  <ItemGroup> 
     154    <Compile Include="eipysty.wav"> 
     155      <Name>eipysty</Name> 
     156      <Importer>WavImporter</Importer> 
     157      <Processor>SoundEffectProcessor</Processor> 
     158    </Compile> 
     159  </ItemGroup> 
    139160  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    140161  <!--  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.