Changeset 7832


Ignore:
Timestamp:
2016-07-06 08:49:35 (3 years ago)
Author:
sieerinn
Message:

SimplePlatformCharacterien? kuva kääntyy ympäri vasemmalle kävellessä, Goomballa on myös kuva ja ne aktivoituu vasta lähelle mentäessä

Location:
2016/27/ohjaajat/VenienteFragore/VenienteFragore
Files:
5 added
6 edited

Legend:

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

    r7814 r7832  
    1414 
    1515        private bool walkRight; 
     16 
     17        private bool active; 
    1618 
    1719        public GoombaEnemy(double width, double height) : base(width, height) 
     
    3638        public override void Update(Time time) 
    3739        { 
     40            if (!active) 
     41            { 
     42                // TODO: Aktivointietäisyys pitäisi laskea esim. näytön leveydestä? 
     43                if (((VenienteFragore)Game).DistanceToNearestPlayer(Position) < 400) 
     44                    active = true; 
     45                else 
     46                    return; 
     47            } 
     48 
    3849            if (CheckCollision(new Vector(2, 1))) 
    3950                walkRight = false; 
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragore/LevelCreationMethods.cs

    r7826 r7832  
    3838            goomba.Speed = 50; 
    3939            goomba.FallOffPlatforms = true; 
     40            goomba.Animation = new Animation(minimiiniiImages) { FPS = 10 }; 
     41            goomba.Animation.Start(); 
    4042            Add(goomba); 
    4143 
    4244            goomba.AddCollisionHandler("player", (a, player) => 
    4345            { 
     46                // Litistyy kun pelaaja hyppää päälle. 
    4447                if (player.Bottom >= goomba.Top) 
    4548                { 
    4649                    goomba.Destroy(); 
    4750                    player.Velocity = new Vector(player.Velocity.X, 400); 
     51 
     52                    var corpse = new GameObject(goomba.Width, goomba.Height * 0.2); 
     53                    corpse.TextureWrapSize = goomba.TextureWrapSize; 
     54                    corpse.Image = minimiiniiImages[0]; 
     55                    corpse.X = goomba.X; 
     56                    corpse.Bottom = goomba.Bottom; 
     57                    corpse.LifetimeLeft = TimeSpan.FromSeconds(1.0); 
     58                    Add(corpse); 
    4859                } 
    4960                else 
    5061                { 
     62                    // Tappaa pelaajan jos osutaan sivulta päin. 
    5163                    player.Destroy(); 
    5264                } 
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragore/SimplePlatformCharacter.cs

    r7826 r7832  
    1818        } 
    1919 
     20        public void Turn(Direction facingDirection) 
     21        { 
     22            if (facingDirection == FacingDirection || (facingDirection != Direction.Left && facingDirection != Direction.Right)) 
     23                return; 
     24            FacingDirection = facingDirection; 
     25            TextureWrapSize = new Vector(-TextureWrapSize.X, TextureWrapSize.Y); 
     26        } 
     27 
    2028        public void Walk(double speed) 
    2129        { 
    22             if (speed > 0) FacingDirection = Direction.Right; 
    23             if (speed < 0) FacingDirection = Direction.Left; 
     30            if (speed > 0) Turn(Direction.Right); 
     31            if (speed < 0) Turn(Direction.Left); 
    2432            Velocity = new Vector(speed, Velocity.Y); 
    2533        } 
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragore/VenienteFragore.cs

    r7828 r7832  
    1616 
    1717        private readonly Image dripImage = LoadImage("drip"); 
     18        private readonly Image[] minimiiniiImages = LoadImages("minimiiniianim\\minimiiniianim", 1, 4); 
    1819 
    1920        private List<Player> advenae; 
     
    3435 
    3536            Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     37        } 
     38 
     39        public double DistanceToNearestPlayer(Vector point) 
     40        { 
     41            return advenae.Min(p => Vector.Distance(p.Position, point)); 
    3642        } 
    3743 
  • 2016/27/ohjaajat/VenienteFragore/VenienteFragore/VenienteFragoreContent/VenienteFragoreContent.contentproj

    r7828 r7832  
    8686    </Compile> 
    8787  </ItemGroup> 
     88  <ItemGroup> 
     89    <Compile Include="minimiiniianim\minimiiniianim1.png"> 
     90      <Name>minimiiniianim1</Name> 
     91      <Importer>TextureImporter</Importer> 
     92      <Processor>TextureProcessor</Processor> 
     93    </Compile> 
     94    <Compile Include="minimiiniianim\minimiiniianim2.png"> 
     95      <Name>minimiiniianim2</Name> 
     96      <Importer>TextureImporter</Importer> 
     97      <Processor>TextureProcessor</Processor> 
     98    </Compile> 
     99    <Compile Include="minimiiniianim\minimiiniianim3.png"> 
     100      <Name>minimiiniianim3</Name> 
     101      <Importer>TextureImporter</Importer> 
     102      <Processor>TextureProcessor</Processor> 
     103    </Compile> 
     104    <Compile Include="minimiiniianim\minimiiniianim4.png"> 
     105      <Name>minimiiniianim4</Name> 
     106      <Importer>TextureImporter</Importer> 
     107      <Processor>TextureProcessor</Processor> 
     108    </Compile> 
     109  </ItemGroup> 
    88110  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    89111  <!--  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

    r7825 r7832  
    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="8"> 
     2<map version="1.0" orientation="orthogonal" renderorder="right-down" width="120" height="40" tilewidth="50" tileheight="50" nextobjectid="9"> 
    33 <tileset firstgid="1" source="VenienteFragoreTileset.tsx"/> 
    44 <layer name="Tiilet" width="120" height="40"> 
     
    2121  <object id="6" name="drip" type="drip" x="5550" y="1750" width="50" height="50"/> 
    2222  <object id="7" name="drip" type="drip" x="2600" y="1400" width="50" height="50"/> 
     23  <object id="8" name="goomba" type="goomba" gid="9" x="900" y="1650" width="50" height="50"/> 
    2324 </objectgroup> 
    2425 <layer name="Etuala" width="120" height="40"> 
Note: See TracChangeset for help on using the changeset viewer.