So I have been working on this game for a bit and I wanted to make a grappler it worked all fine but when it game to enabling the line when needed a problem with the variable happened heres the error message
Assets\GrappleBlock.cs(10,16): error CS1519: Invalid token ';' in class, struct, or interface member declaration
The code:
public class GrappleBlock : MonoBehaviour
{
private SpriteRenderer block;
public Line;
public Color selected, defaultColor;
private SpringJoint2D player;
private bool LetGoBlock = false;
public void Start()
{
block = GetComponent();
}
public void OnMouseOver()
{
block.color = selected;
if(Input.GetMouseButtonDown(1))
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent();
player.enabled = true;
Line.enabled = true;
LetGoBlock = true;
Debug.Log(LetGoBlock);
player.connectedBody = GetComponent();
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Q))
{
player.enabled = false;
Line.enabled = false;
}
}
public void OnMouseExit()
{
block.color = defaultColor;
}
}
↧