Changeset 4426


Ignore:
Timestamp:
2013-07-04 11:07:30 (10 years ago)
Author:
jumakall
Message:
 
Location:
2013/27/TeemuM/Game/Game/Game
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 2013/27/TeemuM/Game/Game/Game/Game.cs

    r4425 r4426  
    126126                    MessageDisplay.Add("-" + commands[2] + " health"); 
    127127                } 
     128            } 
     129            else if (commands[0] == "die") 
     130            { 
     131                UI.GameOver(); 
    128132            } 
    129133            else if (commands[0] == "exit") 
  • 2013/27/TeemuM/Game/Game/Game/Player.cs

    r4424 r4426  
    1717    public IntMeter health; 
    1818    private double power = defaultPower; 
     19    public bool canMove = true; 
    1920 
    2021    public Player(double width, double height, int health, bool addDefaultControls) : base(width, height) 
    2122    { 
    2223        this.health = new IntMeter(health, 0, health); 
    23         //this.health.LowerLimit =  
     24        this.health.LowerLimit += UI.GameOver; 
    2425        this.Tag = "player"; 
    2526        this.Shape = Shape.Rectangle; 
     
    123124    private void MovePlayer(Vector force) 
    124125    { 
    125         this.Push(force); 
     126        if (canMove) 
     127            this.Push(force); 
    126128    } 
    127129 
  • 2013/27/TeemuM/Game/Game/Game/UI.cs

    r4424 r4426  
    1111    public static void GameOver() 
    1212    { 
    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(); 
    1634    } 
    1735} 
Note: See TracChangeset for help on using the changeset viewer.