Changeset 2936 for 2012/24


Ignore:
Timestamp:
2012-06-11 15:05:23 (8 years ago)
Author:
tojukarp
Message:
 
Location:
2012/24/JaakkoL/Crisis Fire
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • 2012/24/JaakkoL/Crisis Fire/FysiikkaPeli1/FysiikkaPeli1/Bullets.cs

    r2908 r2936  
    66using Jypeli.Effects; 
    77using Jypeli.Widgets; 
    8  
    9 public class PrimaryBullet : PhysicsObject 
    10 { 
    11      
    12 } 
  • 2012/24/JaakkoL/Crisis Fire/FysiikkaPeli1/FysiikkaPeli1/Peli.cs

    r2908 r2936  
    1010{ 
    1111    Vector VelocityUp = new Vector(0.0, 250.0); 
     12    Vector FocusedVelocityUp = new Vector(0.0, 125.0); 
    1213    Vector VelocityDown = new Vector(0.0, -250.0); 
     14    Vector FocusedVelocityDown = new Vector(0.0, -125.0); 
    1315    Vector VelocityLeft = new Vector(-250.0, 0.0); 
     16    Vector FocusedVelocityLeft = new Vector(-125.0, 0.0); 
    1417    Vector VelocityRight = new Vector(250.0, 0.0); 
     18    Vector FocusedVelocityRight = new Vector(125.0, 0.0); 
    1519    PhysicsObject Player; 
     20    PhysicsObject SmallEnemy; 
     21    PhysicsObject Enemy; 
     22    PhysicsObject LargeEnemy; 
     23    PhysicsObject Boss; 
     24    PhysicsObject BorderTop; 
     25    PhysicsObject BorderBottom; 
    1626    IntMeter PowerGauge; 
    1727 
     
    2030        Field(); 
    2131        SetControls(); 
     32        CreatePowerGauge(); 
    2233    } 
    23      
     34 
    2435    void Field() 
    2536    { 
    2637        Level.CreateBorders(false); 
    27         Level.BackgroundColor = Color.DarkGreen; 
     38        Level.BackgroundColor = Color.Gray; 
    2839        Camera.ZoomToLevel(); 
    29          
     40 
     41        BorderTop = new PhysicsObject(1000.0, 150.0, Shape.Rectangle); 
     42        BorderTop.Y = Screen.Top - 150.0; 
     43        BorderTop.X = 0.0; 
     44        BorderTop.Color = Color.Black; 
     45        BorderTop.Restitution = 0.0; 
     46        BorderTop.Mass = 9999999999999.0; 
     47        Add(BorderTop); 
     48 
     49        BorderBottom = new PhysicsObject(1000.0, 150.0, Shape.Rectangle); 
     50        BorderBottom.Y = Screen.Bottom + 150.0; 
     51        BorderBottom.X = 0.0; 
     52        BorderBottom.Color = Color.Black; 
     53        BorderBottom.Restitution = 0.0; 
     54        BorderBottom.Mass = 99999999999999.0; 
     55        Add(BorderBottom); 
     56 
    3057        Player = new PhysicsObject(10.0, 10.0, Shape.Circle); 
    31         double massP1 = 75.0; 
     58        double massP1 = 10.0; 
    3259        Player.Mass = massP1; 
    3360        Player.Color = Color.Red; 
    3461        Player.X = -400.0; 
    3562        Player.Y = 0.0; 
    36    
     63 
    3764        Add(Player); 
    3865    } 
     
    4067    void SetControls() 
    4168    { 
     69        // ControllerOne.Listen(Button.A, ButtonState.Pressed, FocusedVelocity, null, Player, null); 
    4270        ControllerOne.Listen(Button.DPadUp, ButtonState.Down, SetVelocity, null, Player, VelocityUp); 
    4371        ControllerOne.Listen(Button.DPadUp, ButtonState.Released, SetVelocity, null, Player, Vector.Zero); 
     
    4977        ControllerOne.Listen(Button.DPadRight, ButtonState.Released, SetVelocity, null, Player, Vector.Zero); 
    5078        ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, null); 
    51         // ControllerOne.Listen(Button.RightTrigger, ButtonState.Down, FirePrimary, null, Player, null); 
    52         // ControllerOne.Listen(Button.LeftTrigger, ButtonState.Down, FireSecondary, null, Player, null); 
     79        ControllerOne.Listen(Button.RightTrigger, ButtonState.Pressed, FirePrimary, null, Player, 10.0, 5.0, Shape.Rectangle); 
     80        ControllerOne.Listen(Button.LeftTrigger, ButtonState.Pressed, FireSecondary, null, Player, 25.0, 10.0, Shape.Diamond); 
     81    } 
     82     
     83    void FirePrimary(PhysicsObject Player, double ShotWidth, double ShotHeight, Shape ShotShape) 
     84    { 
     85        PhysicsObject Primary1 = new PhysicsObject(ShotWidth, ShotHeight, ShotShape); 
     86        Primary1.X = Player.X + 15; 
     87        Primary1.Y = Player.Y + 5; 
     88        PhysicsObject Primary2 = new PhysicsObject(ShotWidth, ShotHeight, ShotShape); 
     89        Primary2.X = Player.X + 15; 
     90        Primary2.Y = Player.Y - 5; 
     91        Add(Primary1); 
     92        Add(Primary2); 
     93        Primary1.Hit(new Vector(1200.0, 0.0)); 
     94        Primary2.Hit(new Vector(1200.0, 0.0)); 
     95    } 
     96 
     97    void FireSecondary(PhysicsObject Player, double ShotWidth, double ShotHeight, Shape ShotShape) 
     98    { 
     99        PhysicsObject Secondary = new PhysicsObject(ShotWidth, ShotHeight, ShotShape); 
     100        Secondary.X = Player.X + 15; 
     101        Secondary.Y = Player.Y; 
     102        Add(Secondary); 
     103        Secondary.Hit(new Vector(500.0, 0.0)); 
    53104    } 
    54105 
     
    61112    { 
    62113        PowerGauge = new IntMeter(0); 
    63   
     114 
    64115        Label PowerMeter = new Label(); 
    65         PowerMeter.X = Screen.Left + 100; 
     116        PowerMeter.X = Screen.Left + 150; 
    66117        PowerMeter.Y = Screen.Top - 100; 
    67118        PowerMeter.TextColor = Color.White; 
     
    72123 
    73124        Label PowerText = new Label("Power: "); 
    74         PowerText.X = Screen.Left + 50; 
     125        PowerText.X = Screen.Left + 100; 
    75126        PowerText.Y = Screen.Top - 100; 
    76127        PowerText.TextColor = Color.White; 
    77128        PowerText.Color = Color.Red; 
     129        Add(PowerText); 
    78130    } 
    79131} 
    80      
     132 
Note: See TracChangeset for help on using the changeset viewer.