Changeset 9128 for 2017/30/HugoE


Ignore:
Timestamp:
2017-07-26 14:42:39 (2 years ago)
Author:
npo17_65
Message:

elämät hahmoilla

Location:
2017/30/HugoE/HanniAndHoo/HanniAndHoo/HanniAndHoo
Files:
5 edited

Legend:

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

    r9125 r9128  
    99public class HanniAndHoo : PhysicsGame 
    1010{ 
    11      Image HanninKuva = LoadImage("Hanni"); 
    12      Image HoonKuva = LoadImage("Hoo"); 
     11    Image HanninKuva = LoadImage("Hanni"); 
     12    Image HoonKuva = LoadImage("Hoo"); 
    1313 
    1414 
    15     PlasmaCannon HanninAse;     
     15 
     16 
     17    PlasmaCannon HanninAse; 
    1618    Cannon HoonAse; 
    17      
    18          
    19     PlatformCharacter Hanni; 
    20     PlatformCharacter Hoo; 
    21      
     19 
     20 
     21    PeliUkko Hanni; 
     22    PeliUkko Hoo; 
     23 
    2224    public override void Begin() 
    2325    { 
     
    2527        LuoPelaajat(); 
    2628        LuoNappaimet(); 
     29 
    2730    } 
    2831 
    2932    void LuoPelaajat() 
    3033    { 
    31         Hanni = new PlatformCharacter(80.0, 80.0); 
     34        Hanni = new PeliUkko(80.0, 80.0); 
    3235        Hanni.X = Level.Left + 100.0; 
    3336        Hanni.Y = 0.0; 
     
    3538        Hanni.Color = Color.Blue; 
    3639        Hanni.Image = HanninKuva; 
    37         Hanni.CanRotate = false;        
     40        Hanni.CanRotate = false; 
    3841        Add(Hanni); 
    3942        HanninAse = new PlasmaCannon(60, 20); 
     
    4144        HanninAse.X += 50; 
    4245        Keyboard.Listen(Key.S, ButtonState.Pressed, AmmuAseella, "Ammu", HanninAse); 
    43         Hanni.Weapon = HanninAse;                 
    44         Hoo = new PlatformCharacter (100.0, 100.0); 
     46        Hanni.Weapon = HanninAse; 
     47        Hoo = new PeliUkko(100.0, 100.0); 
    4548        Hoo.X = Level.Right - 100.0; 
    4649        Hoo.Y = 0.0; 
     
    4952        Hoo.Image = HoonKuva; 
    5053        Hoo.CanRotate = false; 
    51         Add(Hoo);        
    52         HoonAse = new Cannon (90, 30); 
     54        Add(Hoo); 
     55        HoonAse = new Cannon(90, 30); 
    5356        HoonAse.ProjectileCollision = AmmusOsui; 
    5457        HoonAse.X += 80; 
     
    6063    void Tormaa(PhysicsObject tormaaja, PhysicsObject kohde) 
    6164    { 
    62         kohde.Destroy(); 
     65        kohde.Destroy; 
    6366    } 
    6467 
     
    7073    { 
    7174        Keyboard.Listen(Key.W, ButtonState.Pressed, Hyppy, null, Hanni, 1000.0); 
    72         Keyboard.Listen(Key.D, ButtonState.Down, Kavely, null, Hanni, 500.0);        
     75        Keyboard.Listen(Key.D, ButtonState.Down, Kavely, null, Hanni, 500.0); 
    7376        Keyboard.Listen(Key.A, ButtonState.Down, Kavely, null, Hanni, -500.0); 
    7477        Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppy, null, Hoo, 1000.0); 
    7578        Keyboard.Listen(Key.Right, ButtonState.Down, Kavely, null, Hoo, 500.0); 
    76         Keyboard.Listen(Key.Left, ButtonState.Down, Kavely, null, Hoo, -500.0);     
     79        Keyboard.Listen(Key.Left, ButtonState.Down, Kavely, null, Hoo, -500.0); 
    7780        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    7881 
     
    8083    void LuoKentta() 
    8184    { 
    82         Gravity = new Vector(0.0, -800.0);         
     85        Gravity = new Vector(0.0, -800.0); 
     86        Camera.Zoom(1.2); 
    8387        PhysicsObject AlaReuna = Level.CreateBottomBorder(0.0, false); 
    8488        PhysicsObject OikeaReuna = Level.CreateRightBorder(0.0, false); 
    8589        PhysicsObject VasenReuna = Level.CreateLeftBorder(0.0, false); 
    8690        PhysicsObject YläReuna = Level.CreateTopBorder(0.0, false); 
    87  
    88  
    8991    } 
    9092 
     
    9395    void Kavely(PlatformCharacter tyyppi, double liikkumisenMaara) 
    9496    { 
    95          
     97 
    9698        tyyppi.Walk(liikkumisenMaara); 
    9799 
     
    104106    void AmmuAseella(PlasmaCannon HanninAse) 
    105107    { 
    106         PhysicsObject Ammus = HanninAse.Shoot();       
     108        PhysicsObject Ammus = HanninAse.Shoot(); 
    107109        HanninAse.FireRate = 2; 
    108110        if (Ammus != null) 
     
    125127 
    126128    } 
    127      
    128     class Hyvis : PhysicsObject 
    129     { 
    130         private IntMeter elamaLaskuri = new IntMeter(3, 0, 3); 
    131         public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 
    132129 
    133         public Hyvis(double leveys, double korkeus) 
    134         : base(leveys, korkeus) 
    135     { 
    136             elamaLaskuri.LowerLimit += delegate { this.Destroy(); }; 
    137         } 
    138  
    139     } 
    140130 
    141131 
    142132 
    143133} 
    144     
    145     
    146134 
    147     
    148135 
     136class PeliUkko : PlatformCharacter 
     137{ 
     138    public IntMeter Elamalaskuri = new IntMeter(20, 0, 20); 
     139 
     140        public PeliUkko(double leveys, double korkeus) 
     141        : base(leveys, korkeus) 
     142    { 
     143        Elamalaskuri.LowerLimit += delegate { this.Destroy(); }; 
     144    }    
     145} 
     146 
     147 
Note: See TracChangeset for help on using the changeset viewer.