Ignore:
Timestamp:
2015-07-01 08:30:26 (4 years ago)
Author:
sieerinn
Message:

Kojootteja vastaan voi taistella, pelaajalla elämät, kenttiä korjailtu, hoboluola tehty.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/LevelCreation.cs

    r6631 r6632  
    44using System.Text; 
    55using Jypeli; 
     6using Jypeli.Assets; 
    67 
    78/* 
     
    2829        level.SetObjectMethod("exit", CreateExit); 
    2930        level.SetTileMethod("decoration", CreateDecoration); 
    30         level.SetObjectMethod("player", CreatePlayer); 
     31        //level.SetObjectMethod("player", CreatePlayer); 
    3132        level.SetObjectMethod("blockade", CreateBlock); 
    32         // level.SetObjectMethod("coyote", CreateEnemy); 
     33        level.SetObjectMethod("coyote", CreateCoyote); 
    3334        level.Execute(); 
    3435 
     
    4647        Add(block); 
    4748 
     49    } 
     50 
     51    void CreateCoyote(Vector position, double width, double height, Angle angle, Shape shape, string name, Dictionary<string, string> properties) 
     52    { 
     53        var enemy = new Creature(width, height, 1); 
     54        enemy.MoveAnimations = DirectionalAnimations(coyoteLeft, coyoteRight, coyoteUp, coyoteDown); 
     55        enemy.Position = position; 
     56        enemy.Tag = "enemy"; 
     57        enemy.Brain = new FollowerBrain(player) { Speed = 50 }; 
     58        Add(enemy, 1); 
     59        enemies.Add(enemy); 
     60 
     61        AddCollisionHandler(enemy, "playerattack", delegate(PhysicsObject e, PhysicsObject a) 
     62        { 
     63            enemy.Health.Value--; 
     64        }); 
     65 
     66        enemy.Health.LowerLimit += enemy.Destroy; 
     67 
     68        /* 
     69        Timer updateTimer = new Timer(); 
     70        updateTimer.Interval = 0.02; 
     71        updateTimer.Timeout += delegate 
     72        { 
     73            if (!(enemy.Brain is FollowerBrain)) 
     74            { 
     75                 
     76            } 
     77            enemy.UpdateCreature(Time); 
     78        }; 
     79        updateTimer.Start(); 
     80         */ 
    4881    } 
    4982 
     
    68101        player.Inventory.Add(new Grenade(player)); 
    69102 
     103        player.Health.Value = 3; // Alkuun vain kolme sydäntä. 
     104 
    70105        AddCollisionHandler(player, "exit", CollidesWithExit); 
     106        AddCollisionHandler(player, "enemy", delegate(PhysicsObject p, PhysicsObject e) 
     107        { 
     108            player.Health.Value--; 
     109        }); 
    71110    } 
    72111 
Note: See TracChangeset for help on using the changeset viewer.