Changeset 2338


Ignore:
Timestamp:
2011-06-30 10:36:54 (8 years ago)
Author:
teeevasa
Message:

initial bullet collision

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

Legend:

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

    r2337 r2338  
    1717    { 
    1818        Gravity = new Vector(0, -1000); 
    19  
    2019        createLevel(); 
    2120 
     21        // Starts playing the background music, which is set to repeat 
    2222        MediaPlayer.Play("Sounds/Stage1Music"); 
    2323        MediaPlayer.Volume = 0.5; 
     24        MediaPlayer.IsRepeating = true; 
    2425 
    2526        Camera.Follow(player); 
     
    2829    } 
    2930 
     31 
     32    // Creates the level from a text file 
    3033    void createLevel() 
    3134    { 
     
    4346    { 
    4447        player = new Player(33, 74, Shape.Rectangle); 
    45         //Image i = LoadImage("Images/character"); 
    46         //player.Image = i; 
    4748        return player; 
    4849    } 
  • 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Player.cs

    r2337 r2338  
    3131        pistol.Y = 5; 
    3232        this.Weapon = pistol; 
     33 
     34        //pistol.ProjectileCollision += bulletReachedTarget; 
    3335        } 
    3436 
     
    4547        PhysicsObject bullet = this.Weapon.Shoot(); 
    4648        bullet.Hit(new Vector(1000, 0)); 
     49 
     50        // As of now weapons are set to have infinite ammo, but that might change 
     51        if (bullet != null) 
     52        {  
     53             
     54        } 
     55    } 
     56 
     57    void bulletReachedTarget(Bullet bullet, MeleeAlien target) 
     58    {  
     59     
    4760    } 
    4861 
  • 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Weapons.cs

    r2337 r2338  
    88public class Pistol : Weapon 
    99{ 
     10    public CollisionHandler BulletCollision 
     11    { 
     12        get { return ProjectileCollision; } 
     13        set { ProjectileCollision = value; } 
     14    } 
     15 
    1016    public Pistol(double width, double height) 
    1117        : base(width, height) 
     
    1420        AttackSound = Game.LoadSoundEffect("Sounds/pistolshot"); 
    1521        AmmoIgnoresGravity = true; 
     22        InfiniteAmmo = true; 
    1623    } 
    1724 
Note: See TracChangeset for help on using the changeset viewer.