Changeset 6717 for 2015/27/ohjaajat


Ignore:
Timestamp:
2015-07-02 08:32:56 (4 years ago)
Author:
sieerinn
Message:

Pelin voi nyt teoriassa pelata alusta loppuun läpi.

Location:
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel
Files:
1 added
8 edited

Legend:

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

    r6715 r6717  
    2121        : base(width, height) 
    2222    { 
    23         Color = new Color(255, 0, 0, 60); // Debuggausta varten jotta näkee uloskäynnit. 
     23        //Color = new Color(255, 0, 0, 60); // Debuggausta varten jotta näkee uloskäynnit. 
    2424        IgnoresCollisionResponse = true; 
    2525        Tag = "exit"; 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/Item.cs

    r6716 r6717  
    279279} 
    280280 
     281class Mask : Item 
     282{ 
     283    public Mask(Player player) : base(player) 
     284    { 
     285        InventoryImage = TheLegendOfGabriel.MaskLargeImage; 
     286    } 
     287 
     288    public override void UseKeyPressed() 
     289    { 
     290        InUse = true; 
     291        player.CollisionIgnoreGroup = 4; 
     292        base.UseKeyPressed(); 
     293    } 
     294 
     295    public override void UseKeyReleased() 
     296    { 
     297        CancelUse(); 
     298        base.UseKeyReleased(); 
     299    } 
     300 
     301    public override void CancelUse() 
     302    { 
     303        InUse = false; 
     304        player.CollisionIgnoreGroup = 1; 
     305        base.CancelUse(); 
     306    } 
     307} 
     308 
    281309class Monocle : Item 
    282310{ 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/LevelCreation.cs

    r6716 r6717  
    3939        level.SetObjectMethod("boss", CreateBoss); 
    4040        level.SetObjectMethod("bossspawn", CreateBossSpawn); 
     41        level.SetObjectMethod("itemdrop", CreateItem); 
    4142        level.Execute(); 
    4243 
     
    4647    } 
    4748 
     49    private void CreateItem(Vector position, double width, double height, Angle angle, Shape shape, string name, Dictionary<string, string> properties) 
     50    { 
     51        string itemname = properties["name"]; 
     52 
     53        var images = new Dictionary<string, Image>(); 
     54        images["pistol"] = GunImage; 
     55        images["grenade"] = GrenadeImage; 
     56        images["mask"] = MaskImage; 
     57 
     58        var item = PhysicsObject.CreateStaticObject(width, height, shape); 
     59        item.Tag = itemname; 
     60        item.Image = images[itemname]; 
     61        item.Position = position; 
     62        item.IgnoresCollisionResponse = true; 
     63        Add(item); 
     64    } 
     65 
    4866    void CreateEncounter(Vector position, double width, double height, Angle angle, Shape shape, string name, Dictionary<string, string> properties) 
    4967    { 
    5068        if (storyItems.Count < 2) 
    5169        { 
    52             PhysicsObject invisible = new PhysicsObject(width, height) { IsVisible = false, Tag = "storyTime" }; 
     70            PhysicsObject invisible = new PhysicsObject(width, height) { IsVisible = false, Tag = "storyTime", IgnoresCollisionResponse = true }; 
    5371            invisible.MakeStatic(); 
    5472            Add(invisible); 
     
    223241        { 
    224242            int itemType = RandomGen.NextInt(1, 3); 
     243 
     244            if (itemType == 1 && player.Inventory.FirstOrDefault(i => i is Grenade) == null) 
     245                return; 
     246 
     247            if (itemType == 2 && player.Inventory.FirstOrDefault(i => i is Pistol) == null) 
     248                return; 
     249 
    225250            var item = PhysicsObject.CreateStaticObject(10, 10); 
    226251            item.Position = position; 
     
    270295    void CreateBasicTile(Vector position, double width, double height, Image image, int layer, Dictionary<string, string> properties) 
    271296    { 
    272         //var tile = new GameObject(width, height); 
    273         var tile = properties.ContainsKey("collide") ? PhysicsObject.CreateStaticObject(width, height) : new GameObject(width, height); //new PhysicsObject(width, height)  PhysicsObject.CreateStaticObject(width, height) 
     297        bool oil = properties.ContainsKey("damage") && properties["damage"] == "true"; 
     298 
     299        bool solidTile = properties.ContainsKey("collide") || oil; 
     300        var tile =  solidTile? PhysicsObject.CreateStaticObject(width, height) : new GameObject(width, height); 
    274301        tile.Image = image; 
    275302        tile.Position = position; 
     303        if (oil) 
     304        { 
     305            ((PhysicsObject) tile).CollisionIgnoreGroup = 4; 
     306        } 
    276307        Add(tile, layer); 
    277308    } 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs

    r6716 r6717  
    104104    public static Image GrenadeImage = LoadImage("gran"); 
    105105    public static Image GrenadeSmallImage = LoadImage("gransmall"); 
     106    public static Image MaskImage = LoadImage("helm"); 
     107    public static Image MaskLargeImage = LoadImage("helmlarge"); 
    106108 
    107109    public static Image GrenadeBoxImage = LoadImage("grenadebox"); 
     
    377379        Add(player, 1); 
    378380 
    379         player.Sword = new Sword(player); 
    380         player.Inventory.Add(new Pistol(player)); 
    381381        player.Inventory.Add(new Monocle(player)); 
    382         player.Inventory.Add(new Grenade(player)); 
     382 
     383        //player.Sword = new Sword(player); 
     384        //player.Inventory.Add(new Pistol(player)); 
     385        //player.Inventory.Add(new Grenade(player)); 
    383386 
    384387        //player.Health.Value = 3; // Alkuun vain kolme sydäntä. 
     
    412415 
    413416        AddCollisionHandler(player, "storyTime", StoryTime); 
    414     } 
    415  
    416  
    417     void StoryTime(PhysicsObject player, PhysicsObject storyBlock) 
     417 
     418        AddCollisionHandler(player, "pistol", delegate(PhysicsObject p, PhysicsObject item) 
     419        { 
     420            item.Destroy(); 
     421            player.Inventory.Add(new Pistol(player)); 
     422            UpdateItemCycleImages(); 
     423        }); 
     424 
     425        AddCollisionHandler(player, "grenade", delegate(PhysicsObject p, PhysicsObject item) 
     426        { 
     427            item.Destroy(); 
     428            player.Inventory.Add(new Grenade(player)); 
     429            UpdateItemCycleImages(); 
     430        }); 
     431 
     432        AddCollisionHandler(player, "mask", delegate(PhysicsObject p, PhysicsObject item) 
     433        { 
     434            item.Destroy(); 
     435            player.Inventory.Add(new Mask(player)); 
     436            UpdateItemCycleImages(); 
     437        }); 
     438    } 
     439 
     440 
     441    void StoryTime(PhysicsObject pPlayer, PhysicsObject storyBlock) 
    418442    { 
    419443        storyItems.Add(new StoryItem(new Queue<string>(new[] { "Oi, boy!", 
     
    430454        storyBlock.IgnoresCollisionResponse = true; 
    431455 
     456        if (player.Sword == null) 
     457        { 
     458            player.Sword = new Sword(player); 
     459        } 
     460 
    432461        ShowTextItem(storyItems[1]); 
    433462        BuildRightBar(); 
     
    510539 
    511540        canUseExit = false; 
    512         Timer.SingleShot(6, () => canUseExit = true); 
     541        Timer.SingleShot(2, () => canUseExit = true); 
    513542 
    514543        var oldExit = pExit as Exit; 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/TheLegendOfGabrielContent.contentproj

    r6716 r6717  
    384384    </Compile> 
    385385  </ItemGroup> 
     386  <ItemGroup> 
     387    <Compile Include="helmlarge.png"> 
     388      <Name>helmlarge</Name> 
     389      <Importer>TextureImporter</Importer> 
     390      <Processor>TextureProcessor</Processor> 
     391    </Compile> 
     392  </ItemGroup> 
    386393  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    387394  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/bossroom.tmx

    r6703 r6717  
    99 <layer name="decoration" width="15" height="20"> 
    1010  <data encoding="base64" compression="zlib"> 
    11    eJxjYBgFpABWMvAoGDpgNH4HNwAARa8Agw== 
     11   eJxjYBgFpAABMvAoGDpgNH4HNwAAB+wBoQ== 
    1212  </data> 
    1313 </layer> 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/level2.tmx

    r6715 r6717  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <map version="1.0" orientation="orthogonal" renderorder="right-down" width="25" height="25" tilewidth="20" tileheight="20" nextobjectid="10"> 
    3  <tileset firstgid="1" name="LegendOfGabrielTileset" tilewidth="20" tileheight="20"> 
    4   <image source="tileset.png" width="200" height="200"/> 
    5   <tile id="2"> 
    6    <properties> 
    7     <property name="collide" value="true"/> 
    8    </properties> 
    9   </tile> 
    10   <tile id="16"> 
    11    <properties> 
    12     <property name="collide" value="true"/> 
    13    </properties> 
    14   </tile> 
    15   <tile id="23"> 
    16    <properties> 
    17     <property name="collide" value="true"/> 
    18    </properties> 
    19   </tile> 
    20   <tile id="70"> 
    21    <properties> 
    22     <property name="damage" value="true"/> 
    23    </properties> 
    24   </tile> 
    25   <tile id="71"> 
    26    <properties> 
    27     <property name="damage" value="true"/> 
    28    </properties> 
    29   </tile> 
    30   <tile id="72"> 
    31    <properties> 
    32     <property name="damage" value="true"/> 
    33    </properties> 
    34   </tile> 
    35   <tile id="80"> 
    36    <properties> 
    37     <property name="damage" value="true"/> 
    38    </properties> 
    39   </tile> 
    40   <tile id="81"> 
    41    <properties> 
    42     <property name="damage" value="true"/> 
    43    </properties> 
    44   </tile> 
    45   <tile id="82"> 
    46    <properties> 
    47     <property name="damage" value="true"/> 
    48    </properties> 
    49   </tile> 
    50   <tile id="90"> 
    51    <properties> 
    52     <property name="damage" value="true"/> 
    53    </properties> 
    54   </tile> 
    55   <tile id="91"> 
    56    <properties> 
    57     <property name="damage" value="true"/> 
    58    </properties> 
    59   </tile> 
    60   <tile id="92"> 
    61    <properties> 
    62     <property name="damage" value="true"/> 
    63    </properties> 
    64   </tile> 
    65   <tile id="93"> 
    66    <properties> 
    67     <property name="damage" value="false"/> 
    68    </properties> 
    69   </tile> 
    70  </tileset> 
     2<map version="1.0" orientation="orthogonal" renderorder="right-down" width="25" height="25" tilewidth="20" tileheight="20" nextobjectid="12"> 
     3 <tileset firstgid="1" source="LegendOfGabrielTileset.tsx"/> 
    714 <layer name="base" width="25" height="25"> 
    725  <properties> 
     
    747  </properties> 
    758  <data encoding="base64" compression="zlib"> 
    76    eJzVlMEKwCAMQ8WDtx78/5/dZQORtLU1buwQGCh9tk3WSyldkdwav8W4n5EY+hujAr3FyHDGOaC6iBFloZl7LNSTxUVnGuc51/pCDO1OtCfLE947NP8yGSv7O+lt1M/J/HQSY2UnDEbGV18zovnP/l8i2YswLF96YtTf3Wdz3s3IVAO1d+vO82mAw6xfJwaTM+533gcjtxfTNB/j 
     9   eJzFlMEKwCAMQ8WDp+3Q///ZXRxISa2tcTsEBkqebdpJKUUcXQt3dnV36W+mNxKTUYG+YmQ4Yx+QL2JEWajnHgvVNOOiM4vznlt1IYZ1J1rTbCa8d1jzy2Ss5HdytlE9J/dHSIyVTBiMzFz9zYjuf/b/Etm9CGM2l54Y/rt5NufdjJ1qwHvXV/enAQ7TvyoGkzPmq/Ng7O0D0lMf/g== 
    7710  </data> 
    7811 </layer> 
    7912 <layer name="decoration" width="25" height="25"> 
    8013  <data encoding="base64" compression="zlib"> 
    81    eJxjYCAMWIlQQykYtWPUjlE7BtaOUTB4gQAReBQMLSBGBzuGS9lEbzskaGyHBBpNCQAARagBOg== 
     14   eJxjYBgcgHXUjlE7kIA7EHvQ2I5AIA4C4lga2xEMZcdR2Q5YGAUh2UFtEA3EMVBMaTgNFkBJPAwUECACj4KhBcToYMdAl+ND1Q4JGtshgUZTAgBYXgbI 
    8215  </data> 
    8316 </layer> 
     
    8922   <properties> 
    9023    <property name="goto" value="level1@tunnelblockade"/> 
     24   </properties> 
     25  </object> 
     26  <object id="10" x="180" y="0" width="20" height="40"> 
     27   <properties> 
     28    <property name="goto" value="bossroom@enterance"/> 
    9129   </properties> 
    9230  </object> 
     
    10442  </data> 
    10543 </layer> 
     44 <objectgroup name="itemdrop"> 
     45  <object id="11" x="220" y="80" width="20" height="20"> 
     46   <properties> 
     47    <property name="name" value="grenade"/> 
     48   </properties> 
     49  </object> 
     50 </objectgroup> 
    10651</map> 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/level3.tmx

    r6710 r6717  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<map version="1.0" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="20" tileheight="20" nextobjectid="14"> 
    3  <tileset firstgid="1" name="LegendOfGabrielTileset" tilewidth="20" tileheight="20"> 
    4   <image source="tileset.png" width="200" height="200"/> 
    5   <tile id="2"> 
    6    <properties> 
    7     <property name="collide" value="true"/> 
    8    </properties> 
    9   </tile> 
    10   <tile id="16"> 
    11    <properties> 
    12     <property name="collide" value="true"/> 
    13    </properties> 
    14   </tile> 
    15   <tile id="70"> 
    16    <properties> 
    17     <property name="damage" value="true"/> 
    18    </properties> 
    19   </tile> 
    20   <tile id="71"> 
    21    <properties> 
    22     <property name="damage" value="true"/> 
    23    </properties> 
    24   </tile> 
    25   <tile id="72"> 
    26    <properties> 
    27     <property name="damage" value="true"/> 
    28    </properties> 
    29   </tile> 
    30   <tile id="80"> 
    31    <properties> 
    32     <property name="damage" value="true"/> 
    33    </properties> 
    34   </tile> 
    35   <tile id="81"> 
    36    <properties> 
    37     <property name="damage" value="true"/> 
    38    </properties> 
    39   </tile> 
    40   <tile id="82"> 
    41    <properties> 
    42     <property name="damage" value="true"/> 
    43    </properties> 
    44   </tile> 
    45   <tile id="90"> 
    46    <properties> 
    47     <property name="damage" value="true"/> 
    48    </properties> 
    49   </tile> 
    50   <tile id="91"> 
    51    <properties> 
    52     <property name="damage" value="true"/> 
    53    </properties> 
    54   </tile> 
    55   <tile id="92"> 
    56    <properties> 
    57     <property name="damage" value="true"/> 
    58    </properties> 
    59   </tile> 
    60   <tile id="93"> 
    61    <properties> 
    62     <property name="damage" value="false"/> 
    63    </properties> 
    64   </tile> 
    65  </tileset> 
     3 <tileset firstgid="1" source="LegendOfGabrielTileset.tsx"/> 
    664 <layer name="base" width="30" height="20"> 
    675  <data encoding="base64" compression="zlib"> 
     
    719 <layer name="decoration" width="30" height="20"> 
    7210  <data encoding="base64" compression="zlib"> 
    73    eJy1lVEOAjEIRIkn2duon9rPbr3/MZRkmyAZ6NiuJHyVnTd0Cd1EZJvIIjjqpJ7PneC+Tma3T14CnajfVXY5mJpXkuv7nuXfA6ZmQ00G8QDf7y4ZP73X3p96ux0+Wa4P5l78HVtdxGa4DDvjIjbLRXUZF/m07H9xEbskZ2dy/dyP7oSdg0wT1dsa9fQkvK9yPZPR6JHNNMuNmBkX6WnqbmmDmq75i3cbVb53mfL8DkZcv0MRX/93tN+Y8Nxsb9ta5Y7etCj8nI50Rlz0nqGzbI6j+u5zpV+Ga6Ma7hu7xkZ0 
     11   eJy1lUEOwzAIBK18rs2x8bFJ//+MFimWrNWCFyddiZMJAxiTrZSyTVgtXO/JeGi7wP3czD5+tjhxvHqvsuvJNHuIXKx7lr86zNYLVS/y/Q6WmalWn+X2PPNUuSilL9jjPi5jK1yFHXEZW+Uyv4jL8uzZ/+Iydg3O7uTi3I96os5B5n7RR33/V7kjpsc1RTOtcj1mxPXqtt1yDHxazEzuWHO/y4yHO5hxcYd6fG+/KUJutLejOcho9HayXPY/Y2dK/ll/Rdk4/T1/AcNBeQo= 
    7412  </data> 
    7513 </layer> 
     
    8220 </objectgroup> 
    8321 <objectgroup name="itemdrop"> 
    84   <properties> 
    85    <property name="name" value="mask"/> 
    86   </properties> 
    8722  <object id="2" x="150" y="60" width="20" height="20"> 
    8823   <properties> 
     
    9025   </properties> 
    9126  </object> 
    92   <object id="13" x="450" y="380" width="20" height="20"/> 
     27  <object id="13" x="450" y="380" width="20" height="20"> 
     28   <properties> 
     29    <property name="name" value="mask"/> 
     30   </properties> 
     31  </object> 
    9332 </objectgroup> 
    9433 <objectgroup color="#00ff00" name="coyote"> 
     
    10140  <object id="12" x="520" y="340" width="20" height="20"/> 
    10241 </objectgroup> 
    103  <layer name="cover" width="30" height="20"> 
     42 <layer name="cover" width="30" height="20" visible="0"> 
    10443  <data encoding="base64" compression="zlib"> 
    10544   eJxjYBicQAGKB8JOeto9EHZis3sUjIJRMApGwSgYBdQDABOjAaE= 
Note: See TracChangeset for help on using the changeset viewer.