Changeset 5617 for 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid.cs
- Timestamp:
- 2014-07-24 10:47:50 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid.cs
r5600 r5617 13 13 private Image[] shootinganimation = LoadImages("shootinganimation"); 14 14 private Image[] jumpinganimation = LoadImages("jumpinganimation"); 15 private Image[] lifelost = LoadImages("LifeLost"); 15 16 const double nopeus = 200; 16 17 const double hyppyNopeus = 750; 17 18 const int RUUDUN_KOKO = 40; 18 19 PlasmaCannon pelaajan1Ase; 20 DoubleMeter health; 19 21 20 22 … … 28 30 public override void Begin() 29 31 { 32 SmoothTextures = false; 33 AloitaPeli(); 34 } 35 36 void AloitaPeli() 37 { 38 ClearAll(); 30 39 Gravity = new Vector(0, -1000); 31 SmoothTextures = false;32 40 33 41 LuoKentta(); 34 42 LisaaNappaimet(); 43 LuoPistelaskuri(); 35 44 36 45 Camera.Follow(pelaaja1); … … 92 101 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -nopeus); 93 102 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 94 Keyboard.Listen(Key. Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus);103 Keyboard.Listen(Key.Space, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 95 104 Keyboard.Listen(Key. C, ButtonState.Pressed, Ammu, "Ampuu", pelaajan1Ase); 96 105 … … 119 128 maaliAani.Play(); 120 129 MessageDisplay.Add("Ouch!"); 130 health.Value -= 2; 131 121 132 //stumper.Destroy(); 122 133 } … … 129 140 void LuoPistelaskuri() 130 141 { 131 IntMeter pelaajanElamat = new IntMeter(10); 132 pelaajanElamat.MinValue = 0; 133 pelaajanElamat.LowerLimit += PelaajaHaviaa; 142 health = new DoubleMeter(10); 143 health.MaxValue = 15; 144 health.MinValue = 0; 145 health.LowerLimit += PelaajaHaviaa; 146 /* 147 health.Changed += delegate 148 { 149 Animation anim = new Animation(lifelost); 150 anim.FPS = 2.0; 151 pelaaja1.PlayAnimation(anim); 152 }; 153 */ 154 ProgressBar healthMeter = new ProgressBar(150, 20); 155 healthMeter.X = Screen.Left + 150; 156 healthMeter.Y = Screen.Top - 100; 157 healthMeter.BindTo(health); 158 Add(healthMeter); 159 160 healthMeter.Angle = Angle.RightAngle; 161 healthMeter.Color = Color.Transparent; 162 healthMeter.BarColor = Color.Red; 163 healthMeter.BorderColor = Color.Black; 164 165 166 134 167 } 135 168 void PelaajaHaviaa() 136 169 { 137 170 MessageDisplay.Add("Life Lost..."); 171 pelaaja1.Destroy(); 172 GameObject kuoli = new GameObject(pelaaja1.Width, pelaaja1.Height); 173 kuoli.Image = lifelost[0]; 174 kuoli.Position = pelaaja1.Position; 175 Add(kuoli); 176 177 Timer.SingleShot(2, kuoli.Destroy); 178 Timer.SingleShot(5, AloitaPeli); 138 179 } 139 180 }
Note: See TracChangeset
for help on using the changeset viewer.