error CS8025: Parsing error: dont know what to do here
using UnityEngine; using System.Collections;
public class playercontroller : MonoBehaviour {
//player handling public float speed = 8; public float acceleration = 12;
private float CurrentSpeed; private float targetSpeed; private Vector2 amountToMove;
private playerphysics playerphysics;
 // Use this for initialization
 void Start () {
 playerphysics = GetComponent <playerphysics>();
 }
 
 // Update is called once per frame
 void Update () {
 targetSpeed =Input.GetAxisRow("Horizontal") *speed;
 CurrentSpeed = IncrementTowards(currentSpeed,targetSpeed,acceleration);    
} // increase n towards target by speed private float IncrementTowards(float n, float target , float a) { if (n== target){ return n; } else{ float dir = Mathf .Sign(target - n); //must n be increased or decreased to get closer to target n+= a Time.delraTime dir; return (dir == Mathf. Sign(target-n))? n: target; //if n has now passed target then return target,otherwise return n } }
Answer by Vicarian · Jun 27, 2017 at 01:28 PM
The problem was where you tried to accumulate n with a product of the variable a, Time.deltaTime, and dir. You mistyped deltaTime as delraTime.
 using UnityEngine;
 using System.Collections;
 
 public class playercontroller : MonoBehaviour {
     //player handling 
     public float speed = 8; 
     public float acceleration = 12;
 
     private float CurrentSpeed; 
     private float targetSpeed; 
     private Vector2 amountToMove;
 
     private playerphysics playerphysics;
 
     // Use this for initialization
     void Start () {
         playerphysics = GetComponent <playerphysics>();
     }
      
     // Update is called once per frame
     void Update () {
         targetSpeed = Input.GetAxisRow("Horizontal") *speed;
         CurrentSpeed = IncrementTowards(currentSpeed,targetSpeed,acceleration);
     } 
     
     // increase n towards target by speed 
     private float IncrementTowards(float n, float target , float a) 
     { 
         if (n== target)
         { 
             return n; 
         } 
         else
         { 
             float dir = Mathf .Sign(target - n); 
             //must n be increased or decreased to get closer to target 
             n+= a * Time.deltaTime * dir; 
             return (dir == Mathf. Sign(target-n)) ? n : target; //if n has now passed target then return target,otherwise return n 
         } 
     }
 }
Your answer
 
 
             Follow this Question
Related Questions
problems with mopub 0 Answers
InvalidCastException: Cannot cast from source type to destination type. 1 Answer
The body of '' cannot be an iterator block because 'void' is not an iterator interface type??? 2 Answers
C# Mouselook Script errors, need assistance. 1 Answer
InvalidOperationException: Collection was modified; enumeration operation may not execute 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                