Question by 
               Avinity · Jul 23, 2019 at 01:15 PM · 
                c#scripting problemmovement script  
              
 
              Why isn't my player moving down?
Hi,
I'm creating a movement script for my player (2D project pixel art) and basically everything works as it should except for the up and down function.
When I press "W or the up key" my player goes up ... so + on y... But when I press "S or the down key" my player is also going up on y... which is weird.
I'm starting C# since I'm more of a designer so my code is probably longer than necessrary but for now I'm just trying to learn and fix my problems :-)
Thanks in advance!
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class PlayerMovement : MonoBehaviour
 {
     public float playerMovementSpeed = 3f;
 
     private void FixedUpdate()
     {
 
         float h = Input.GetAxisRaw("Horizontal");
         float v = Input.GetAxisRaw("Vertical");
 
         if (h != 0f)
         {
             transform.Translate(new Vector2(h * playerMovementSpeed * Time.deltaTime, 0f));
         } else if (v != 0f)
         {
             transform.Translate(new Vector2(v * 0f, playerMovementSpeed * Time.deltaTime));
         }
 
     }
 
 
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                