Ignore:
Timestamp:
2015-06-26 07:24:36 (4 years ago)
Author:
sieerinn
Message:

F8-näppäimellä tulee kuolemattomuusmoodi.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs

    r6414 r6421  
    250250    private int levelNumber = 0; 
    251251 
     252    private bool invincibility = false; 
    252253    private Action activateBoss; 
    253254    private Timer fireballTimer; 
     
    12341235        AddCollisionHandler(player, "burn", delegate(PhysicsObject p, PhysicsObject t) 
    12351236        { 
    1236             player.Life.Value--; 
     1237            if (!invincibility) 
     1238                player.Life.Value--; 
    12371239        }); 
    12381240 
    12391241        AddCollisionHandler(player, "lava", delegate(PhysicsObject p, PhysicsObject t) 
    12401242        { 
    1241             player.Life.Value = player.Life.MinValue; 
     1243            if (!invincibility) 
     1244                player.Life.Value = player.Life.MinValue; 
    12421245        }); 
    12431246 
     
    12501253            else 
    12511254            { 
    1252                 player.Life.Value--; 
     1255                if (!invincibility) 
     1256                    player.Life.Value--; 
    12531257            } 
    12541258        }); 
    1255  
    12561259 
    12571260        player.Life.LowerLimit += delegate 
     
    13311334        Keyboard.Listen(Key.Enter, ButtonState.Pressed, GetRidOfImprovement, "Player 1 throws their tools away", startingPlayers[1]); 
    13321335 
     1336        Keyboard.Listen(Key.F8, ButtonState.Pressed, Invincibility, null); // Demonstraatio tarkoituksiin. 
    13331337        Keyboard.Listen(Key.F9, ButtonState.Pressed, Loss, null); 
    13341338        Keyboard.Listen(Key.F12, ButtonState.Pressed, NextLevel, null); 
     
    13371341        Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Show help"); 
    13381342        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Exit game"); 
     1343    } 
     1344 
     1345    void Invincibility() 
     1346    { 
     1347        invincibility = !invincibility; 
     1348        MessageDisplay.Add("Invincibility mode " + (invincibility ? "on" : "off")); 
    13391349    } 
    13401350 
Note: See TracChangeset for help on using the changeset viewer.