Changeset 5636 for 2014/30


Ignore:
Timestamp:
2014-07-24 14:56:52 (9 years ago)
Author:
iimlart
Message:
 
Location:
2014/30/AleksiK
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/AleksiK/TToDHS/TToDHS/TToDHS/TToDHS.cs

    r5588 r5636  
    4040    Label luetDocua; 
    4141    Label potionInInv; 
    42  
    43     //TO DO: Nainen + MustaTakit, TutorialBattle + Stats + Party, Tarinaa ->, muut huoneet, itemit, battlet 
     42    Label taisto1; 
     43    Label taisto2; 
     44    Label taisto3; 
     45 
     46    //TO DO: TutorialBattle, Tarinaa ->, muut huoneet, itemit, battlet 
    4447 
    4548    public override void Begin() 
     
    6972        steinExp.UpperLimit += delegate { steinExp.MaxValue *= steinLvl.Value; }; 
    7073        steinExp.UpperLimit += delegate { steinExp.Reset(); }; 
     74        mustaTakkiHp.MinValue = 0; 
    7175    } 
    7276 
     
    210214        Keyboard.Listen(Key.W, ButtonState.Down, AsiaNopeus, null, stein, 0.0, ruutuNelionSivu * 5, 0.0); 
    211215        Keyboard.Listen(Key.S, ButtonState.Down, AsiaNopeus, null, stein, 0.0, -ruutuNelionSivu * 5, 0.0); 
    212         Keyboard.Listen(Key.E, ButtonState.Pressed, InventorinTilanMuutos, null, 0); 
     216        Keyboard.Listen(Key.E, ButtonState.Pressed, InventorinTilanMuutos, null, 0, 0); 
    213217    } 
    214218 
     
    411415    //Laita Label("Inventory") Inventoryn yläosaan! 
    412416 
    413     void InventorinTilanMuutos(int x) 
    414     { 
    415         if (x == 0) 
     417    void InventorinTilanMuutos(int x, int y) 
     418    { 
     419        if (x == 0 && y == 0) 
    416420        { 
    417421            ClearControls(); 
    418             Keyboard.Listen(Key.E, ButtonState.Pressed, InventorinTilanMuutos, null, 1); 
     422            Keyboard.Listen(Key.E, ButtonState.Pressed, InventorinTilanMuutos, null, 1, 0); 
    419423 
    420424            inventory = PhysicsObject.CreateStaticObject(ruutuNelionSivu * 10, ruutuNelionSivu * 20); 
     
    435439        } 
    436440 
    437         else if (x == 1 && potionLaskuri.Value > 0) 
     441        else if (x == 1 && y == 0 && potionLaskuri.Value > 0) 
    438442        { 
    439443            inventory.Destroy(); 
     
    442446        } 
    443447 
    444         else if (x== 1) 
     448        else if (x== 1 && y == 0) 
    445449        { 
    446450            inventory.Destroy();   
    447451            SteinKontrollit(0); 
    448452        } 
     453 
     454        else if (x == 0 && y == 1) 
     455        { 
     456            taisto1.Destroy(); 
     457            taisto2.Destroy(); 
     458            taisto3.Destroy(); 
     459             
     460            Keyboard.Listen(Key.E, ButtonState.Pressed, InventorinTilanMuutos, null, 1, 1); 
     461 
     462            inventory = PhysicsObject.CreateStaticObject(ruutuNelionSivu * 10, ruutuNelionSivu * 20); 
     463            inventory.Color = Color.LightGray; 
     464            inventory.IgnoresCollisionResponse = true; 
     465            inventory.CollisionIgnoreGroup = 1; 
     466            inventory.Position = taistoStein.Position; 
     467            Add(inventory); 
     468 
     469            if (potionLaskuri.Value > 0) 
     470            { 
     471                potionInInv = new Label("Potion"); 
     472                potionInInv.Position = new Vector(-inventory.Width / 4, inventory.Height / 7 * 2.3); 
     473                potionInInv.Font = Font.DefaultLarge; 
     474                potionInInv.TextColor = Color.Red; 
     475                Add(potionInInv); 
     476            } 
     477        } 
     478 
     479        else if (x == 1 && y == 1 && potionLaskuri.Value > 0) 
     480        { 
     481            inventory.Destroy(); 
     482            potionInInv.Destroy(); 
     483            ClearControls(); 
     484            LuoTaistoValikko(); 
     485        } 
     486 
     487        else if (x == 1 && y == 1) 
     488        { 
     489            inventory.Destroy(); 
     490            ClearControls(); 
     491            LuoTaistoValikko(); 
     492        } 
    449493    } 
    450494 
     
    454498    { 
    455499        steinLuontiPiste = stein.Position; 
    456         HuoneenValo(0, 2); 
    457  
    458         Timer.SingleShot(0.75, delegate { ClearGameObjects(); 
    459                                           //HuoneenValo(0, 1); 
    460                                           TileMap taistelu = TileMap.FromLevelAsset("Taistelu"); 
    461                                           taistelu.SetTileMethod('V', LuoTaistoon, 0); 
    462                                           taistelu.SetTileMethod('S', LuoTaistoon, 1); 
    463                                           taistelu.SetTileMethod('N', LuoTaistoon, 2); 
    464                                           taistelu.Execute(ruutuNelionSivu, ruutuNelionSivu); }); 
    465         Timer.SingleShot(1.5, delegate { LuoTaistoValikko(); }); 
     500        //HuoneenValo(0, 2); 
     501        ClearGameObjects(); 
     502        //HuoneenValo(0, 1); 
     503        TileMap taistelu = TileMap.FromLevelAsset("Taistelu"); 
     504        taistelu.SetTileMethod('V', LuoTaistoon, 0); 
     505        taistelu.SetTileMethod('S', LuoTaistoon, 1); 
     506        taistelu.SetTileMethod('N', LuoTaistoon, 2); 
     507        taistelu.Execute(ruutuNelionSivu, ruutuNelionSivu); 
     508        LuoTaistoValikko(); 
    466509    } 
    467510 
     
    499542        taistoKohdat = new List<Label>(); 
    500543 
    501         Label taisto1 = new Label("Attack"); 
     544        taisto1 = new Label("Attack"); 
    502545        taisto1.Position = new Vector(-160, -30); 
    503546        taisto1.Font = Font.DefaultLarge; 
    504547        taistoKohdat.Add(taisto1); 
    505548 
    506         Label taisto2 = new Label("Defend"); 
     549        taisto2 = new Label("Defend"); 
    507550        taisto2.Position = new Vector(-10, -30); 
    508551        taisto2.Font = Font.DefaultLarge; 
    509552        taistoKohdat.Add(taisto2); 
    510553 
    511         Label taisto3 = new Label("Inventory"); 
     554        taisto3 = new Label("Inventory"); 
    512555        taisto3.Position = new Vector(140, -30); 
    513556        taisto3.Font = Font.DefaultLarge; 
     
    519562        } 
    520563 
     564        LuoTaistoValikonHiiri(); 
     565    } 
     566 
     567    void LuoTaistoValikonHiiri() 
     568    { 
    521569        Mouse.ListenOn(taisto1, MouseButton.Left, ButtonState.Pressed, SteinAttack, null); 
    522570        Mouse.ListenOn(taisto2, MouseButton.Left, ButtonState.Pressed, SteinDefend, null); 
    523         Mouse.ListenOn(taisto3, MouseButton.Left, ButtonState.Pressed, InventorinTilanMuutos, null, 0); 
     571        Mouse.ListenOn(taisto3, MouseButton.Left, ButtonState.Pressed, InventorinTilanMuutos, null, 0, 1); 
    524572        Mouse.ListenMovement(1.0, TaistoKohtaHiiri, null); 
    525573    } 
     
    541589    } 
    542590 
     591    //ERROR: MaxValue must be greater than zero. -Kohdassa mustaTakki.Hp -= jne... 
     592 
    543593    void SteinAttack() 
    544594    { 
    545         mustaTakkiHp.Value -= (steinDmg.Value -= mustaTakkiDef.Value); 
     595        mustaTakkiHp.Value -= (steinDmg.Value -= mustaTakkiDef.Value += RandomGen.NextInt(1 - 4)); 
     596        mustaTakkiHp.LowerLimit += delegate { taistoMustaTakki.Destroy(); }; 
    546597    } 
    547598 
Note: See TracChangeset for help on using the changeset viewer.