Ignore:
Timestamp:
2018-07-30 14:38:07 (15 months ago)
Author:
lukrmoil
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2017/30/HugoE/HanniAndHoo/HanniAndHoo/HanniAndHoo/HanniAndHoo.cs

    r9237 r9822  
    4444        Hanni.Tag = "pelaaja"; 
    4545        Add(Hanni); 
     46        Hanni.Ohjain = ControllerOne; 
    4647        HanninAse = new PlasmaCannon(60, 20);         
    4748        HanninAse.ProjectileCollision = AmmusOsui; 
    4849        HanninAse.X += 50; 
    49         Keyboard.Listen(Key.S, ButtonState.Pressed, AmmuAseella, "Ammu", HanninAse); 
    50         ControllerOne.Listen(Button.RightTrigger, ButtonState.Pressed, AmmuAseella, "Ammu", HanninAse); 
    5150        HanninAse.CanHitOwner = false; 
    5251        Hanni.Weapon = HanninAse; 
     
    6059        Hoo.CanRotate = false; 
    6160        Add(Hoo); 
     61        Hoo.Ohjain = ControllerTwo; 
    6262        HoonAse = new Cannon(90, 30); 
    6363        HoonAse.ProjectileCollision = Ammus2Osui; 
    6464        HoonAse.X += 80; 
    6565        Hoo.Weapon = HoonAse; 
    66         Keyboard.Listen(Key.Down, ButtonState.Pressed, AmmuAseella2, "Ammu2", HoonAse); 
    67         ControllerTwo.Listen(Button.RightTrigger, ButtonState.Pressed, AmmuAseella2, "Ammu", HoonAse); 
    6866        HoonAse.CanHitOwner = false; 
    69         HoonAse.Power.DefaultValue = 25000; 
     67        HoonAse.Power.DefaultValue = 32500; 
    7068        HoonAse.Power.Value = HoonAse.Power.DefaultValue; 
    7169        AddCollisionHandler(Hanni, "AlaReuna", ResattaaHyppyLaskuri); 
     70        AddCollisionHandler(Hanni, "sivureuna", KimpoaReunasta); 
     71        AddCollisionHandler(Hoo, "sivureuna", KimpoaReunasta); 
    7272        AddCollisionHandler(Hoo, "Alareuna", ResattaaHyppyLaskuri); 
    7373        AddCollisionHandler(Hanni, Hoo, ResattaaHyppyLaskuri); 
     
    7575        Hoo.Elamalaskuri.LowerLimit += LoppuValikko; 
    7676        Hanni.Elamalaskuri.LowerLimit += LoppuValikko;         
     77    } 
     78 
     79    void KimpoaReunasta(PhysicsObject tormaaja, PhysicsObject kohde) 
     80    { 
     81        PeliUkko aija = (PeliUkko)tormaaja; 
     82        aija.Hit(-tormaaja.Position); 
     83        aija.Ohjain.DisableAll(); 
     84        Timer.SingleShot(0.3, delegate { PalautaOhjain(aija.Ohjain); }); 
     85    } 
     86 
     87    private void PalautaOhjain(Controller ohjain) 
     88    { 
     89        ohjain.EnableAll(); 
     90        ClearControls(); 
     91        LuoNappaimet(); 
    7792    } 
    7893 
     
    116131        if (!Kohde.Tag.Equals("pelaaja")) return; 
    117132        PeliUkko pu = (PeliUkko)Kohde; 
    118         pu.Elamalaskuri.AddValue(-1); 
     133        pu.Elamalaskuri.AddValue(-2); 
    119134        PeliUkko pu2 = (PeliUkko)Tormaaja; 
    120         pu2.Elamalaskuri.AddValue(1); 
     135        pu2.Elamalaskuri.AddValue(5); 
    121136         
    122137    } 
     
    128143        PeliUkko pu = (PeliUkko)Kohde; 
    129144         
    130         pu.Elamalaskuri.AddValue(-5); 
     145        pu.Elamalaskuri.AddValue(-8); 
    131146        if (Ammus.Tag.Equals("PelaajanAmmus")) 
    132147        { 
    133            Hanni.Elamalaskuri.AddValue(1); 
     148           Hanni.Elamalaskuri.AddValue(3); 
    134149        } 
    135150         
     
    141156        if (!Kohde2.Tag.Equals("pelaaja")) return; 
    142157        PeliUkko pu = (PeliUkko)Kohde2; 
    143         pu.Elamalaskuri.AddValue(-7); 
     158        pu.Elamalaskuri.AddValue(-11); 
    144159 
    145160 
     
    148163    void LuoNappaimet() 
    149164    { 
    150         Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppy, null, Hanni, 1000.0); 
    151         Keyboard.Listen(Key.D, ButtonState.Down, Kavely, null, Hanni, 500.0); 
    152         Keyboard.Listen(Key.A, ButtonState.Down, Kavely, null, Hanni, -500.0); 
    153         Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppy, null, Hoo, 1000.0); 
    154         Keyboard.Listen(Key.Right, ButtonState.Down, Kavely, null, Hoo, 250.0); 
    155         Keyboard.Listen(Key.Left, ButtonState.Down, Kavely, null, Hoo, -250.0); 
    156  
    157  
     165        //Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppy, null, Hanni, 1250.0); 
     166        //Keyboard.Listen(Key.D, ButtonState.Down, Kavely, null, Hanni, 650.0); 
     167        //Keyboard.Listen(Key.A, ButtonState.Down, Kavely, null, Hanni, -650.0); 
     168        //Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppy, null, Hoo, 1250.0); 
     169        //Keyboard.Listen(Key.Right, ButtonState.Down, Kavely, null, Hoo, 350.0); 
     170        //Keyboard.Listen(Key.Left, ButtonState.Down, Kavely, null, Hoo, -350.0); 
     171        //Keyboard.Listen(Key.S, ButtonState.Pressed, AmmuAseella, "Ammu", HanninAse); 
     172        //Keyboard.Listen(Key.Down, ButtonState.Pressed, AmmuAseella2, "Ammu2", HoonAse); 
    158173        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    159  
    160  
    161         ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppy, null, Hanni, 1000.0); 
    162         ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Kavely, null, Hanni, 500.0); 
    163         ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Kavely, null, Hanni, -500.0); 
    164  
    165  
    166         ControllerTwo.Listen(Button.A, ButtonState.Down, Hyppy, null, Hoo, 500.0); 
    167         ControllerTwo.Listen(Button.DPadRight, ButtonState.Down, Kavely, null, Hoo, 500.0); 
    168         ControllerTwo.Listen(Button.DPadLeft, ButtonState.Down, Kavely, null, Hoo, -500.0);         
     174     
     175        ControllerOne.Listen(Button.RightTrigger, ButtonState.Pressed, AmmuAseella, "Ammu", HanninAse); 
     176        ControllerTwo.Listen(Button.RightTrigger, ButtonState.Pressed, AmmuAseella2, "Ammu", HoonAse); 
     177 
     178        ControllerOne.Listen(Button.A, ButtonState.Pressed, Hyppy, null, Hanni, 1350.0); 
     179        ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Kavely, null, Hanni, 650.0); 
     180        ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Kavely, null, Hanni, -650.0); 
     181 
     182        ControllerTwo.Listen(Button.A, ButtonState.Down, Hyppy, null, Hoo, 1150.0); 
     183        //ControllerTwo.Listen(Button.A, ButtonState.Up, Hyppy, null, Hoo, 1000.0); 
     184        ControllerTwo.Listen(Button.DPadRight, ButtonState.Down, Kavely, null, Hoo, 300.0); 
     185        ControllerTwo.Listen(Button.DPadLeft, ButtonState.Down, Kavely, null, Hoo, -300.0); 
     186 
    169187    } 
    170188    void LuoKentta() 
     
    179197        Level.Background.Image = taustis; 
    180198        Level.Background.ScaleToLevelByWidth(); 
    181         Gravity = new Vector(0.0, -800.0);         
     199        Gravity = new Vector(0.0, -1750.0);         
    182200        PhysicsObject AlaReuna = Level.CreateBottomBorder(0.0, true); 
     201        AlaReuna.Y += 75; 
    183202        AlaReuna.Tag = "AlaReuna"; 
     203        AlaReuna.Color = Color.Brown; 
    184204        PhysicsObject OikeaReuna = Level.CreateRightBorder(1.0, true); 
    185205        OikeaReuna.Tag = "OikeaReuna"; 
     206        OikeaReuna.Tag = "sivureuna"; 
    186207        PhysicsObject VasenReuna = Level.CreateLeftBorder(1.0, true); 
    187208        VasenReuna.Tag = "VasenReuna"; 
     209        VasenReuna.Tag = "sivureuna"; 
    188210        PhysicsObject YlaReuna = Level.CreateTopBorder(0.0, true); 
    189211        YlaReuna.Tag = "YlaReuna"; 
     
    232254    } 
    233255 
    234  
    235  
     256   
    236257    void AmmuAseella(PlasmaCannon HanninAse) 
    237258    { 
    238259        PhysicsObject Ammus = HanninAse.Shoot();         
    239         HanninAse.FireRate = 2.5; 
     260        HanninAse.FireRate = 3; 
    240261        if (Ammus != null) 
    241262        { 
     
    249270    { 
    250271        PhysicsObject Ammus2 = HoonAse.Shoot(); 
    251         HoonAse.FireRate = 1.5; 
     272        HoonAse.FireRate = 2; 
    252273        if (Ammus2 != null) 
    253274        { 
    254             Ammus2.Size *= 4; 
    255             Ammus2.MaximumLifetime = TimeSpan.FromSeconds(4.0); 
     275            Ammus2.Size *= 5; 
     276            Ammus2.MaximumLifetime = TimeSpan.FromSeconds(4.5); 
    256277            Ammus2.Tag = "Pelaajan2Ammus"; 
    257278 
     
    262283    class PeliUkko : PlatformCharacter 
    263284    { 
    264         public IntMeter Elamalaskuri = new IntMeter(40, 0, 40); 
     285        public IntMeter Elamalaskuri = new IntMeter(80, 0, 80); 
    265286        public IntMeter HyppyLaskuri = new IntMeter(0, 0, 2); 
    266  
     287        public Controller Ohjain;         
    267288        public PeliUkko(double leveys, double korkeus) 
    268289        : base(leveys, korkeus) 
     
    278299        
    279300    }    
    280      
    281     
    282  
    283  
     301        
    284302} 
    285303 
Note: See TracChangeset for help on using the changeset viewer.