Changeset 7825 for 2016/27


Ignore:
Timestamp:
2016-07-05 21:59:04 (3 years ago)
Author:
sieerinn
Message:

Tippuvia pisaroita luolaan

Location:
2016/27/ohjaajat/VenienteFragore/VenienteFragore
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragore/VenienteFragore.cs

    r7822 r7825  
    1616        private Dictionary<string, ObjectMethod> objectMethods; 
    1717 
     18        private Image dripImage = LoadImage("drip"); 
     19 
    1820        private List<Player> advenae; 
    1921 
     
    4749            objectMethods.Add("door", CreateDoor); 
    4850            objectMethods.Add("goomba", CreateGoomba); 
     51            objectMethods.Add("drip", CreateWaterDrip); 
    4952 
    5053            var tileMap = TiledTileMap.FromLevelAsset(lvlName); 
     
    7275            borderleft = new SimplePhysics.Object(TileSize, Level.Height) { X = Camera.X + Window.Width / 2, IsVisible = false }; 
    7376            Add(borderleft); 
    74             borderright = new SimplePhysics.Object(TileSize, Level.Height) { X = Camera.X - Window.Width / 2, IsVisible = false}; 
     77            borderright = new SimplePhysics.Object(TileSize, Level.Height) { X = Camera.X - Window.Width / 2, IsVisible = false }; 
    7578            Add(borderright); 
    7679 
     
    104107                    break; 
    105108            } 
    106              
    107             borderleft.X = Camera.X + Window.Width / 2 ; 
     109 
     110            borderleft.X = Camera.X + Window.Width / 2; 
    108111            borderright.X = Camera.X - Window.Width / 2; 
    109112        } 
     
    120123        { 
    121124            if (objectMethods.ContainsKey(name)) 
    122             objectMethods[name](position, width, height, properties); 
     125                objectMethods[name](position, width, height, properties); 
    123126            else 
    124127                throw new Exception("Unknown object type: " + name); 
     
    191194        } 
    192195 
     196        void CreateWaterDrip(Vector position, double width, double height, Dictionary<string, string> properties) 
     197        { 
     198            // Luo ajastetusti vesipisaroita. 
     199            var dripTimer = new Timer { Interval = RandomGen.NextDouble(1.0, 4.0) }; 
     200            dripTimer.Timeout += () => 
     201            { 
     202                Add(new SimplePhysics.Object(10, 10) 
     203                { 
     204                    Position = position, 
     205                    Image = dripImage, 
     206                    LifetimeLeft = TimeSpan.FromSeconds(5), 
     207                    IgnoresCollisionResponse = true 
     208                }, -1); 
     209            }; 
     210            dripTimer.Start(); 
     211        } 
     212 
    193213        private void SetMovementKeys(Player adven, List<Key> keys) 
    194214        { 
     
    391411        private void CreateDoor(Vector position, double width, double height, Dictionary<string, string> properties) 
    392412        { 
    393            string lvlName = properties["levelName"]; 
     413            string lvlName = properties["levelName"]; 
    394414            InteractableObject door = new InteractableObject(width, height); 
    395415            door.Position = position; 
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragoreContent/VenienteFragoreContent.contentproj

    r7822 r7825  
    7272    </Compile> 
    7373  </ItemGroup> 
     74  <ItemGroup> 
     75    <Compile Include="drip.png"> 
     76      <Name>drip</Name> 
     77      <Importer>TextureImporter</Importer> 
     78      <Processor>TextureProcessor</Processor> 
     79    </Compile> 
     80  </ItemGroup> 
    7481  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    7582  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragoreContent/desolatecaves.tmx

    r7823 r7825  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <map version="1.0" orientation="orthogonal" renderorder="right-down" width="120" height="40" tilewidth="50" tileheight="50" nextobjectid="3"> 
     2<map version="1.0" orientation="orthogonal" renderorder="right-down" width="120" height="40" tilewidth="50" tileheight="50" nextobjectid="8"> 
    33 <tileset firstgid="1" source="VenienteFragoreTileset.tsx"/> 
    44 <layer name="Tiilet" width="120" height="40"> 
     
    1616   </properties> 
    1717  </object> 
     18  <object id="3" name="drip" type="drip" x="1450" y="1350" width="50" height="50"/> 
     19  <object id="4" name="drip" type="drip" x="2400" y="1400" width="50" height="50"/> 
     20  <object id="5" name="drip" type="drip" x="2950" y="1700" width="50" height="50"/> 
     21  <object id="6" name="drip" type="drip" x="5550" y="1750" width="50" height="50"/> 
     22  <object id="7" name="drip" type="drip" x="2600" y="1400" width="50" height="50"/> 
    1823 </objectgroup> 
    1924 <layer name="Etuala" width="120" height="40"> 
Note: See TracChangeset for help on using the changeset viewer.