Ignore:
Timestamp:
2015-06-26 04:22:46 (5 years ago)
Author:
mijoliim
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/MikkoL/JRPG/JRPG/JRPG/MainGame.cs

    r6415 r6416  
    200200    void MoveLeft(double Distance) 
    201201    { 
    202          
     202        SetAnimations(); 
     203 
    203204        if (Keyboard.GetKeyState(Key.Right) != ButtonState.Down && Movement.FacingDir == Movement.Direction.Left 
    204205            || CheckIfAnotherArrowKeyIsDown(Key.Left, Key.Right) && Movement.FacingDir == Movement.Direction.Left 
     
    213214    void MoveRight(double Distance) 
    214215    { 
     216        SetAnimations(); 
     217 
    215218        if (Keyboard.GetKeyState(Key.Left) != ButtonState.Down && Movement.FacingDir == Movement.Direction.Right 
    216219            || CheckIfAnotherArrowKeyIsDown(Key.Right, Key.Left) && Movement.FacingDir == Movement.Direction.Right 
     
    225228    void MoveUp(double Distance) 
    226229    { 
     230        SetAnimations(); 
     231 
    227232        if (Keyboard.GetKeyState(Key.Down) != ButtonState.Down && Movement.FacingDir == Movement.Direction.Up 
    228233            || CheckIfAnotherArrowKeyIsDown(Key.Up, Key.Down) && Movement.FacingDir == Movement.Direction.Up 
     
    237242    void MoveDown(double Distance) 
    238243    { 
     244        SetAnimations(); 
     245 
    239246        if (Keyboard.GetKeyState(Key.Up) != ButtonState.Down && Movement.FacingDir == Movement.Direction.Down 
    240247            || CheckIfAnotherArrowKeyIsDown(Key.Down, Key.Up) && Movement.FacingDir == Movement.Direction.Down 
     
    243250            if (Movement.CanMoveDown) 
    244251            { 
    245                 Player.Move(new Vector(0, -Distance), GameValues.MOVE_SPEED); 
     252                Player.Move(new Vector(0, -Distance), GameValues.MOVE_SPEED);; 
    246253            } 
    247254        } 
     
    310317    #endregion 
    311318 
     319    public void SetAnimations() 
     320    { 
     321        if (Movement.FacingDir == Movement.Direction.Up && JRPG.Game.Keyboard.GetKeyState(Key.Up) == ButtonState.Pressed && !Movement.IsMoving) 
     322        { 
     323            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingUp); 
     324            Player.Animation.Start(); 
     325        } 
     326        else if (Movement.FacingDir == Movement.Direction.Down && JRPG.Game.Keyboard.GetKeyState(Key.Down) == ButtonState.Pressed && !Movement.IsMoving) 
     327        { 
     328            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingDown); 
     329            Player.Animation.Start(); 
     330        } 
     331        else if (Movement.FacingDir == Movement.Direction.Left && JRPG.Game.Keyboard.GetKeyState(Key.Left) == ButtonState.Pressed && !Movement.IsMoving) 
     332        { 
     333            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingLeft); 
     334            Player.Animation.Start(); 
     335        } 
     336        else if (Movement.FacingDir == Movement.Direction.Right && JRPG.Game.Keyboard.GetKeyState(Key.Right) == ButtonState.Pressed && !Movement.IsMoving) 
     337        { 
     338            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingRight); 
     339            Player.Animation.Start(); 
     340        } 
     341        else if (Movement.FacingDir == Movement.Direction.Up && JRPG.Game.Keyboard.GetKeyState(Key.Up) == ButtonState.Down && !Movement.IsMoving) 
     342        { 
     343            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingUp); 
     344            Player.Animation.Start(); 
     345        } 
     346        else if (Movement.FacingDir == Movement.Direction.Down && JRPG.Game.Keyboard.GetKeyState(Key.Down) == ButtonState.Down && !Movement.IsMoving) 
     347        { 
     348            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingDown); 
     349            Player.Animation.Start(); 
     350        } 
     351        else if (Movement.FacingDir == Movement.Direction.Left && JRPG.Game.Keyboard.GetKeyState(Key.Left) == ButtonState.Down && !Movement.IsMoving) 
     352        { 
     353            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingLeft); 
     354            Player.Animation.Start(); 
     355        } 
     356        else if (Movement.FacingDir == Movement.Direction.Right && JRPG.Game.Keyboard.GetKeyState(Key.Right) == ButtonState.Down && !Movement.IsMoving) 
     357        { 
     358            Player.Animation = new Animation(Images.Characters.Overworld.Sonic_WalkingRight); 
     359            Player.Animation.Start(); 
     360        } 
     361        else if (Movement.FacingDir == Movement.Direction.Up && !Movement.IsMoving) 
     362        { 
     363            Player.Animation = null; 
     364            Player.Image = Images.Characters.Overworld.Sonic_Standing_Up; 
     365        } 
     366        else if (Movement.FacingDir == Movement.Direction.Down && !Movement.IsMoving) 
     367        { 
     368            Player.Animation = null; 
     369            Player.Image = Images.Characters.Overworld.Sonic_Standing_Down; 
     370        } 
     371        else if (Movement.FacingDir == Movement.Direction.Left && !Movement.IsMoving) 
     372        { 
     373            Player.Animation = null; 
     374            Player.Image = Images.Characters.Overworld.Sonic_Standing_Left; 
     375        } 
     376        else if (Movement.FacingDir == Movement.Direction.Right && !Movement.IsMoving) 
     377        { 
     378            Player.Animation = null; 
     379            Player.Image = Images.Characters.Overworld.Sonic_Standing_Right; 
     380        } 
     381        /* 
     382        if (Player.Animation.FPS != 5) 
     383        { 
     384            Player.Animation.FPS = 5; 
     385        }*/ 
     386    } 
     387 
    312388    public void FadeOut() 
    313389    { 
Note: See TracChangeset for help on using the changeset viewer.