Changeset 4426
- Timestamp:
- 2013-07-04 11:07:30 (10 years ago)
- Location:
- 2013/27/TeemuM/Game/Game/Game
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/27/TeemuM/Game/Game/Game/Game.cs
r4425 r4426 126 126 MessageDisplay.Add("-" + commands[2] + " health"); 127 127 } 128 } 129 else if (commands[0] == "die") 130 { 131 UI.GameOver(); 128 132 } 129 133 else if (commands[0] == "exit") -
2013/27/TeemuM/Game/Game/Game/Player.cs
r4424 r4426 17 17 public IntMeter health; 18 18 private double power = defaultPower; 19 public bool canMove = true; 19 20 20 21 public Player(double width, double height, int health, bool addDefaultControls) : base(width, height) 21 22 { 22 23 this.health = new IntMeter(health, 0, health); 23 //this.health.LowerLimit =24 this.health.LowerLimit += UI.GameOver; 24 25 this.Tag = "player"; 25 26 this.Shape = Shape.Rectangle; … … 123 124 private void MovePlayer(Vector force) 124 125 { 125 this.Push(force); 126 if (canMove) 127 this.Push(force); 126 128 } 127 129 -
2013/27/TeemuM/Game/Game/Game/UI.cs
r4424 r4426 11 11 public static void GameOver() 12 12 { 13 GameObject layer = new GameObject(Math.Abs(G.game.Level.Left) + Math.Abs(G.game.Level.Right), Math.Abs(G.game.Level.Bottom) + Math.Abs(G.game.Level.Top), Shape.Rectangle); 14 layer.Color = Color.Lerp(Color.Black, Color.Transparent, 0.5); 15 G.game.Add(layer); 13 double opacity = 0; 14 //G.game.IsPaused = true; 15 16 Widget layer = new Widget(G.Screen.Width, G.Screen.Height, Shape.Rectangle); 17 layer.Color = Color.Lerp(Color.Transparent, Color.Black, opacity); 18 //layer.Position = G.game.player.Position; 19 //G.game.Add(layer, 1); 20 layer.AbsoluteAngle = Angle.Zero; 21 layer.RotateImage = false; 22 G.game.player.Add(layer); 23 24 25 Timer t = new Timer(); 26 t.Timeout += delegate() { 27 opacity += 0.01; 28 layer.Color = Color.Lerp(Color.Transparent, Color.Black, opacity); 29 if (opacity >= 0.7) 30 t.Stop(); 31 }; 32 t.Interval = 0.01; 33 t.Start(); 16 34 } 17 35 }
Note: See TracChangeset
for help on using the changeset viewer.