-1

Image

So I´ve been working with unity this days for school and I have the coding for a spaceship to move only in certain space with the variables hori and vert like this:

var vert: float = 0

and

var hori: float = 0

but the program tells me its a semicolon instead of the colon i dont know why and also i use && and it says syntax error... someone please help me

user3071284
  • 6,955
  • 6
  • 43
  • 57
amvd
  • 3
  • 4
  • could you include the code chunk with everything related and the specific error? – depperm Jan 08 '16 at 19:51
  • i will post an image – amvd Jan 08 '16 at 19:54
  • didnt let me post the image but the link – amvd Jan 08 '16 at 19:57
  • why are you using `float`, when it looks like `int` should do – depperm Jan 08 '16 at 20:09
  • I am using a tutuorial and it said to use float... I will try with int! – amvd Jan 08 '16 at 20:13
  • 1
    @amvd The following are for your future reference. 1) **[How do I format my code blocks?](http://meta.stackexchange.com/q/22186/293688)**? and 2) What is a **[Minimal, Complete and Verifiable Example](http://stackoverflow.com/help/mcve)**? – AGE Jan 08 '16 at 20:26
  • Possible duplicate of [colon in variable declaration](http://stackoverflow.com/questions/18940578/colon-in-variable-declaration) – user3071284 Jan 08 '16 at 21:37

1 Answers1

0

The problem with the && is improper parenthesis. You have:

if(Input.GetKey(KeyCode.UpArrow)) && vert < 3) {

and I think it should be something like:

if(Input.GetKey(KeyCode.UpArrow) && vert < 3) {
depperm
  • 10,606
  • 4
  • 43
  • 67