Unexpected Symbol 'end of file' error
I have tried everything and i can't get this script to work I was wondering if I could get some help on it. It is a 2D game and I would like a force applied on the sprite instead of changing its position. Thank You for your help!
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class A : MonoBehaviour { public float speed; void Update () { if(Input.GetKeyDown(KeyCode.A)){ transform.Translate (Vector2.right "speed" -1); } if(Input.GetKeyDown(KeyCode.D)){ transform.Translate (Vector2.right * "speed"); } }
Answer by aFeesh · Feb 07, 2017 at 01:00 AM
Remove the quotes from "speed" and set speed to an initial value like 1. Also, you're missing an asterisk after the first Vector2.right
Your answer
Follow this Question
Related Questions
How can I move my 2D car in 16 fixed angles like in Retro City Rampage 1 Answer
sprite bug: animator doesnt work and it gets bigger 0 Answers
Object movement algorithm 0 Answers
Can't make non-smooth movement script 0 Answers
Detecting missing collision in 2D platformer to change direction for enemy - without Raycast 1 Answer