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

messed w/ weapons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    } 
Note: See TracChangeset for help on using the changeset viewer.