Question by 
               HaloRacer39 · Feb 03, 2017 at 03:43 AM · 
                c#javaconversionspaceshipscrollwheel  
              
 
              Java to C# Translation
Can someone please help translate this code for me? I'm trying to make a space fighter simulator to where the ship will move at a constant speed that is adjustable with the scroll wheel. Thanks so much! Here's the code:
 var defaultSpeed = 50.0; // speed to default towards if no keys are pressed
  var maxSpeed = 75.0; 
  var minSpeed = 25.0;
  var maxAcceleration = 5.0; // Controls the acceleration
  var currentSpeed = 50.0;
  
  // var Player = transform;  // this line gave me an error and it isn't needed any way
  
  function Update() 
  {
      transform.Translate(Vector3.forward * Time.deltaTime * currentSpeed);
  
      if(Input.GetKey("up"))
      currentSpeed += maxAcceleration * Time.deltaTime;
      else if(Input.GetKey("down"))
      currentSpeed-=maxAcceleration * Time.deltaTime;
      else if (currentSpeed > defaultSpeed){
          currentSpeed -= maxAcceleration * Time.deltaTime;
          currentSpeed = Mathf.Clamp(currentSpeed, defaultSpeed, maxSpeed);
      }
      else {
          currentSpeed += maxAcceleration * Time.deltaTime;
          currentSpeed = Mathf.Clamp(currentSpeed, minSpeed, defaultSpeed);
      }
      currentSpeed = Mathf.Clamp(currentSpeed, minSpeed, maxSpeed);
  }
               Comment
              
 
               
              Answer by DanSparrow · Feb 03, 2017 at 04:35 AM
You should try something like this http://www.carlosag.net/tools/codetranslator/ it can help you with the basic translation and of course you'll have to look for possible errors, and change some details, but it may help
Thank you so much, this was such a help. A few adjustments were needed, but a great resource that i will continue to use!
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                