Changeset 2348


Ignore:
Timestamp:
2011-06-30 12:40:53 (8 years ago)
Author:
teeevasa
Message:

messed w/ weapons

Location:
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/GenCharacter.cs

    r2300 r2348  
    3131 
    3232    // A particlular method for reducing hit points. It also handles death, when it  
    33     private void reduceHitPointsBy(int reduction) 
     33    public void reduceHitPointsBy(int reduction) 
    3434    { 
    3535        if (hitPoints > reduction) 
  • 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Peli.cs

    r2345 r2348  
    5353    MeleeAlien addMeleeAlien() 
    5454    { 
    55         MeleeAlien meleeAlien = new MeleeAlien(45, 80, Shape.Rectangle, 10, "Patrol"); 
     55        MeleeAlien meleeAlien = new MeleeAlien(45, 80, Shape.Rectangle, 50, "Patrol"); 
    5656        return meleeAlien; 
    5757    } 
  • 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Player.cs

    r2343 r2348  
    2424        this.CollisionIgnoreGroup = 1; 
    2525 
     26        // Creating the timer system that is *supposed* to enable a nice walking sound effect 
    2627        walker = new Timer(); 
    2728        walker.Interval = 0.7; 
    2829        walker.Trigger += playWalkingSound; 
    2930 
     31        // Creating the weapon; for now only a pistol 
    3032        Pistol pistol = new Pistol(20.0, 10.0); 
    3133        pistol.X = 5; 
    3234        pistol.Y = 10; 
    3335        this.Weapon = pistol; 
     36        pistol.ProjectileCollision += bulletReachedTarget; 
    3437 
    35         pistol.ProjectileCollision += bulletReachedTarget; 
     38        // Collision handlers for enemies 
     39        AddCollisionHandler(); 
    3640        } 
    3741 
     
    5559    } 
    5660 
    57     void bulletReachedTarget(PhysicsObject bullet, PhysicsObject target) 
     61    private void bulletReachedTarget(PhysicsObject bullet, PhysicsObject target) 
    5862    { 
    5963        bullet.Destroy(); 
     
    6165        if (target.Tag == "MeleeAlien") 
    6266        { 
    63             target.Destroy(); 
     67            MeleeAlien alien = (MeleeAlien)target; 
     68            //alien.reduceHitPointsBy(this.Weapon.firePower()); 
     69            alien.reduceHitPointsBy(10); 
    6470        } 
    6571    } 
  • 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Weapons.cs

    r2342 r2348  
    2424        return proj; 
    2525    } 
     26 
     27    public int reloadTime() 
     28    { 
     29        return 1; 
     30    } 
     31 
     32    public int firePower() 
     33    { 
     34        return 10; 
     35    } 
     36 
     37    public string name() 
     38    { 
     39        return "Pistol"; 
     40    } 
    2641} 
Note: See TracChangeset for help on using the changeset viewer.