Changeset 4227


Ignore:
Timestamp:
2013-06-25 22:10:13 (10 years ago)
Author:
otelretu
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.cs

    r4219 r4227  
    99class Vihu : PhysicsObject 
    1010{ 
    11     private IntMeter health = new IntMeter(3, 0, 3); 
     11    private IntMeter health = new IntMeter(5, 0, 5); 
    1212    public IntMeter Health { get { return health; } } 
    1313     
     
    1515        : base(leveys, korkeus, muoto) 
    1616    { 
    17         ProgressBar elamaPalkki = new ProgressBar(6, 2.5); 
    18         elamaPalkki.BindTo(health); 
    19         Add(elamaPalkki); 
    20  
    21         health.LowerLimit += delegate {  
    22             this.Destroy();  
     17        ProgressBar enemyhealth = new ProgressBar(6, 2.5); 
     18        enemyhealth.BindTo(health); 
     19        Add(enemyhealth); 
     20 
     21        health.LowerLimit += delegate { 
     22            this.Destroy(); 
    2323        }; 
    2424    } 
    2525} 
    26  
    2726public class Projekti : PhysicsGame 
    2827{ 
     
    240239 
    241240        PlasmaCannon hostilew = new PlasmaCannon(0, 0); 
    242         hostilew.ProjectileCollision = weaponhit; 
     241        hostilew.ProjectileCollision = plasmahit; 
    243242        hostilew.FireRate = 0.5; 
    244243        hostilew.Power.DefaultValue = 700; 
     
    263262//    { 
    264263//        health = new DoubleMeter(10); 
    265 //        health.MaxValue = 10; 
     264//        health.MaxValue = 100; 
    266265//        //healthbar.LowerLimit += ElamaLoppui; 
    267266// 
     
    394393            case 1: 
    395394                weapon = new AssaultRifle(0, 0); 
    396                 weapon.ProjectileCollision = weaponhit; 
     395                weapon.ProjectileCollision = projectilehit; 
    397396                weapon.FireRate = 4.5; 
    398397                weapon.Power.Value = 100; 
     
    401400            case 2: 
    402401                weapon = new LaserGun(0, 0); 
    403                 weapon.ProjectileCollision = weaponhit; 
     402                weapon.ProjectileCollision = laserhit; 
    404403                weapon.FireRate = 1; 
    405404                weapon.Power.DefaultValue = 1200; 
     
    408407            case 3: 
    409408                weapon = new PlasmaCannon(0, 0); 
    410                 weapon.ProjectileCollision = weaponhit; 
     409                weapon.ProjectileCollision = plasmahit; 
    411410                weapon.FireRate = 1.5; 
    412411                weapon.Power.Value = 750; 
     
    421420            case 1: 
    422421                weapon2 = new AssaultRifle(0, 0); 
    423                 weapon2.ProjectileCollision = weaponhit; 
     422                weapon2.ProjectileCollision = projectilehit; 
    424423                weapon2.FireRate = 4.5; 
    425424                weapon2.Power.Value = 100; 
     
    428427            case 2: 
    429428                weapon2 = new LaserGun(0, 0); 
    430                 weapon2.ProjectileCollision = weaponhit; 
     429                weapon2.ProjectileCollision = laserhit; 
    431430                weapon2.FireRate = 1; 
    432431                weapon2.Power.DefaultValue = 1200; 
     
    435434            case 3: 
    436435                weapon2 = new PlasmaCannon(0, 0); 
    437                 weapon2.ProjectileCollision = weaponhit; 
     436                weapon2.ProjectileCollision = plasmahit; 
    438437                weapon2.FireRate = 1.5; 
    439438                weapon2.Power.Value = 750; 
     
    445444    { 
    446445        PhysicsObject ammus = ase.Shoot(); 
    447  
    448446        if (ammus != null) 
    449447        { 
     
    452450            //ammus.Image = ...; 
    453451            //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
    454             ammus.MaximumLifetime = TimeSpan.FromDays(1.0); 
     452            ammus.MaximumLifetime = TimeSpan.FromMinutes(1.0); 
    455453            if (ase is AssaultRifle) 
    456454            { 
     
    474472            } 
    475473        } 
    476  
    477     } 
    478  
    479     void weaponhit(PhysicsObject ammus, PhysicsObject kohde) 
    480     { 
    481  
     474    } 
     475    void projectilehit(PhysicsObject ammus, PhysicsObject kohde) 
     476    { 
    482477        if (kohde.Tag == "hostile") 
    483478        { 
    484479            Vihu vihollinen = kohde as Vihu; 
    485480            vihollinen.Health.Value -= 1; 
     481        } 
     482    } 
     483    void laserhit(PhysicsObject ammus, PhysicsObject kohde) 
     484    { 
     485        if (kohde.Tag == "hostile") 
     486        { 
     487            Vihu vihollinen = kohde as Vihu; 
     488            vihollinen.Health.Value -= 5; 
     489        } 
     490    } 
     491    void plasmahit(PhysicsObject ammus, PhysicsObject kohde) 
     492    { 
     493        if (kohde.Tag == "hostile") 
     494        { 
     495            Vihu vihollinen = kohde as Vihu; 
     496            vihollinen.Health.Value -= 3; 
    486497        } 
    487498    } 
     
    541552        Spawnhostiles(); 
    542553        Controlsship(); 
     554 
    543555        Timer a = new Timer(); 
    544         a.Interval = 1; 
     556        a.Interval = 8; 
    545557        a.Timeout += Spawnhostiles; 
    546558        a.Start(); 
     
    559571 
    560572        Timer a = new Timer(); 
    561         a.Interval = 5; 
     573        a.Interval = 8; 
    562574        a.Timeout += Spawnhostiles; 
    563575        a.Start(); 
Note: See TracChangeset for help on using the changeset viewer.