Changeset 6545
- Timestamp:
- 2015-06-29 22:20:48 (6 years ago)
- Location:
- 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel
- Files:
-
- 25 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs
r6544 r6545 2 2 using System.Collections.Generic; 3 3 using System.Linq; 4 using System.Reflection; 4 5 using Jypeli; 5 6 using Jypeli.Assets; … … 61 62 List<Exit> exits = new List<Exit>(); 62 63 63 public override void Begin() 64 #region Resources 65 66 [AssetName("walkright")] 67 private Animation playerWalkRight; 68 [AssetName("walkright", mirror: true)] 69 private Animation playerWalkLeft; 70 71 #endregion 72 73 public override void Begin() 64 74 { 65 75 SmoothTextures = false; 76 LoadAnimations(); 66 77 StartGame(); 78 } 79 80 /// <summary> 81 /// Lataa automaagisesti kaikki animaatiot. 82 /// </summary> 83 private void LoadAnimations() 84 { 85 // Haetaan tämän luokan kaikki ei-julkiset attribuutit. 86 foreach (var field in GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) 87 { 88 // Jos attribuutille on laitettu AsseName, niin ladataan sen niminen animaatio. 89 var assetAttr = Attribute.GetCustomAttribute(field, typeof(AssetNameAttribute)) as AssetNameAttribute; 90 if (assetAttr == null) continue; 91 var anim = LoadAnimation(assetAttr.AssetName); 92 field.SetValue(this, assetAttr.Mirror ? MirrorAnimation(anim) : anim); 93 } 94 } 95 96 /// <summary> 97 /// Peilaa kaikki animaation kuvat. 98 /// </summary> 99 private static Animation MirrorAnimation(Animation anim) 100 { 101 return new Animation(anim.Select(Image.Mirror).ToArray()) { FPS = anim.FPS }; 67 102 } 68 103 … … 71 106 ClearAll(); 72 107 CreateLevel("level1"); 73 // CreatePlayer(new Vector(-Level.Width/3, Level.Bottom + TILE_SIZE * 2));108 // CreatePlayer(new Vector(-Level.Width/3, Level.Bottom + TILE_SIZE * 2)); 74 109 SetControls(); 75 110 Camera.ZoomToLevel(); -
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.csproj
r6536 r6545 111 111 </ItemGroup> 112 112 <ItemGroup> 113 <Compile Include="AssetNameAttribute.cs" /> 113 114 <Compile Include="LevelCreation.cs" /> 114 115 <Compile Include="Ohjelma.cs" /> -
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/TheLegendOfGabrielContent.contentproj
r6544 r6545 92 92 </Compile> 93 93 </ItemGroup> 94 <ItemGroup> 95 <Compile Include="walkdown.anim"> 96 <Name>walkdown</Name> 97 <Importer>AnimationImporter</Importer> 98 <Processor>AnimationContentProcessor</Processor> 99 </Compile> 100 <Compile Include="walkright.anim"> 101 <Name>walkright</Name> 102 <Importer>AnimationImporter</Importer> 103 <Processor>AnimationContentProcessor</Processor> 104 </Compile> 105 <Compile Include="walkup.anim"> 106 <Name>walkup</Name> 107 <Importer>AnimationImporter</Importer> 108 <Processor>AnimationContentProcessor</Processor> 109 </Compile> 110 </ItemGroup> 94 111 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 95 112 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.