Changeset 4446


Ignore:
Timestamp:
2013-07-04 15:34:20 (10 years ago)
Author:
jumakall
Message:
 
Location:
2013/27/TeemuM/Game/Game/Game
Files:
1 added
3 edited

Legend:

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

    r4444 r4446  
    2929        menu.AddItemHandler(2, PerkMenu); 
    3030        menu.AddItemHandler(3, Exit); 
    31         MediaPlayer.Play("MenuMusic"); 
    3231        Add(menu); 
    3332 
     
    6665                    Score(int.Parse(commands[2])); 
    6766                } 
    68             } 
    69             else if (commands[0] == "tenthleveltaurenchieftain") 
    70             { 
    71                 MediaPlayer.Play("SpesialEasterEgg"); 
    7267            } 
    7368            else if (commands[0] == "level") 
     
    142137            else if (commands[0] == "die") 
    143138            { 
    144                 UI.GameOver(); 
    145             } 
    146             else if (commands[0] == "player") 
    147             { 
    148                 if (commands[1] == "stop") 
    149                 { 
    150                     MediaPlayer.Stop(); 
    151                 } 
     139                // UI.GameOver(); 
    152140            } 
    153141            else if (commands[0] == "exit") 
    154142            { 
    155143                Exit(); 
     144            } 
     145            else if (commands[0] == "maintenance") 
     146            { 
     147                int c = 0; 
     148                for (int i = 0; i < enemies.Count; i++) 
     149                { 
     150                    if (enemies[i].IsDestroyed) 
     151                    { 
     152                        enemies.RemoveAt(i); 
     153                        i--; 
     154                    } 
     155                } 
     156 
     157                MessageDisplay.Add(c + " entities removed"); 
    156158            } 
    157159            else { MessageDisplay.Add("Unknow command!"); } 
     
    168170        Keyboard.Listen(Key.Tab, ButtonState.Pressed, DeveloperCommand, null); 
    169171 
    170         MediaPlayer.Stop(); 
    171         Timer mPlayer = new Timer(); 
    172         mPlayer.Interval = 3; 
    173         mPlayer.Timeout += BackgroundMusicPlayer; 
    174         mPlayer.Start(); 
     172        player = new Player(50, 50, 10, true); 
     173        Add(player); 
     174        Camera.Follow(player); 
    175175 
    176176        AddScoreMeter(); 
    177  
    178         Image background = LoadImage("Background"); 
    179         Level.Background.Image = background; 
    180  
    181         player = new Player(50, 50, 10, true); 
    182         Camera.Follow(player); 
    183         Add(player); 
    184         SpawnZombie(); 
    185177        CreateLifeMeter(); 
    186178 
    187179        Timer t = new Timer(); 
    188         t.Interval = 1; 
     180        t.Interval = 0.1; 
    189181        t.Timeout += delegate() { SpawnZombie(); }; 
    190182        t.Start(); 
    191     } 
    192  
    193     private void BackgroundMusicPlayer() 
    194     { 
    195         if (!MediaPlayer.IsPlaying) 
    196             MediaPlayer.Play("GameM" + RandomGen.NextInt(1, 5)); 
    197183    } 
    198184 
  • 2013/27/TeemuM/Game/Game/Game/Game.csproj

    r4424 r4446  
    111111  </ItemGroup> 
    112112  <ItemGroup> 
     113    <Compile Include="AudioPlayer.cs" /> 
    113114    <Compile Include="Enemies.cs" /> 
    114115    <Compile Include="Ohjelma.cs" /> 
     
    116117    <Compile Include="Player.cs" /> 
    117118    <Compile Include="Properties\AssemblyInfo.cs" /> 
    118     <Compile Include="UI.cs" /> 
    119119  </ItemGroup> 
    120120  <ItemGroup> 
  • 2013/27/TeemuM/Game/Game/Game/Player.cs

    r4426 r4446  
    2222    { 
    2323        this.health = new IntMeter(health, 0, health); 
    24         this.health.LowerLimit += UI.GameOver; 
     24        this.health.LowerLimit += delegate 
     25        { 
     26            GameObject layer = new GameObject(Game.Screen.Width, Game.Screen.Height); 
     27            layer.Color = Color.Transparent; 
     28            layer.Position = this.Position; 
     29            Game.Add(layer, 1); 
     30            layer.FadeColorTo(Color.Lerp(Color.Transparent, Color.Black, 0.8), 1.0); 
     31 
     32            Label t = new Label("Game over"); 
     33            t.Position = this.Position; 
     34            Game.Add(t); 
     35 
     36            Timer.SingleShot(1, delegate { Game.IsPaused = true; }); 
     37 
     38            this.Destroy(); 
     39        }; 
    2540        this.Tag = "player"; 
    2641        this.Shape = Shape.Rectangle; 
Note: See TracChangeset for help on using the changeset viewer.