Changeset 2936
- Timestamp:
- 2012-06-11 15:05:23 (9 years ago)
- 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 6 6 using Jypeli.Effects; 7 7 using Jypeli.Widgets; 8 9 public class PrimaryBullet : PhysicsObject10 {11 12 } -
2012/24/JaakkoL/Crisis Fire/FysiikkaPeli1/FysiikkaPeli1/Peli.cs
r2908 r2936 10 10 { 11 11 Vector VelocityUp = new Vector(0.0, 250.0); 12 Vector FocusedVelocityUp = new Vector(0.0, 125.0); 12 13 Vector VelocityDown = new Vector(0.0, -250.0); 14 Vector FocusedVelocityDown = new Vector(0.0, -125.0); 13 15 Vector VelocityLeft = new Vector(-250.0, 0.0); 16 Vector FocusedVelocityLeft = new Vector(-125.0, 0.0); 14 17 Vector VelocityRight = new Vector(250.0, 0.0); 18 Vector FocusedVelocityRight = new Vector(125.0, 0.0); 15 19 PhysicsObject Player; 20 PhysicsObject SmallEnemy; 21 PhysicsObject Enemy; 22 PhysicsObject LargeEnemy; 23 PhysicsObject Boss; 24 PhysicsObject BorderTop; 25 PhysicsObject BorderBottom; 16 26 IntMeter PowerGauge; 17 27 … … 20 30 Field(); 21 31 SetControls(); 32 CreatePowerGauge(); 22 33 } 23 34 24 35 void Field() 25 36 { 26 37 Level.CreateBorders(false); 27 Level.BackgroundColor = Color. DarkGreen;38 Level.BackgroundColor = Color.Gray; 28 39 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 30 57 Player = new PhysicsObject(10.0, 10.0, Shape.Circle); 31 double massP1 = 75.0;58 double massP1 = 10.0; 32 59 Player.Mass = massP1; 33 60 Player.Color = Color.Red; 34 61 Player.X = -400.0; 35 62 Player.Y = 0.0; 36 63 37 64 Add(Player); 38 65 } … … 40 67 void SetControls() 41 68 { 69 // ControllerOne.Listen(Button.A, ButtonState.Pressed, FocusedVelocity, null, Player, null); 42 70 ControllerOne.Listen(Button.DPadUp, ButtonState.Down, SetVelocity, null, Player, VelocityUp); 43 71 ControllerOne.Listen(Button.DPadUp, ButtonState.Released, SetVelocity, null, Player, Vector.Zero); … … 49 77 ControllerOne.Listen(Button.DPadRight, ButtonState.Released, SetVelocity, null, Player, Vector.Zero); 50 78 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)); 53 104 } 54 105 … … 61 112 { 62 113 PowerGauge = new IntMeter(0); 63 114 64 115 Label PowerMeter = new Label(); 65 PowerMeter.X = Screen.Left + 1 00;116 PowerMeter.X = Screen.Left + 150; 66 117 PowerMeter.Y = Screen.Top - 100; 67 118 PowerMeter.TextColor = Color.White; … … 72 123 73 124 Label PowerText = new Label("Power: "); 74 PowerText.X = Screen.Left + 50;125 PowerText.X = Screen.Left + 100; 75 126 PowerText.Y = Screen.Top - 100; 76 127 PowerText.TextColor = Color.White; 77 128 PowerText.Color = Color.Red; 129 Add(PowerText); 78 130 } 79 131 } 80 132
Note: See TracChangeset
for help on using the changeset viewer.