im in unity 2018.2.2if1 and i started to code in a few months ago
this is my code but everytime that i play the game the message “the namespace global already contains a definition for” and i don´t known where´s my mistake
can someone help me pls??
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Samus : MonoBehaviour {
public float velocity;
public float jumpPower;
public bool isGround;
public float health;
public string nomeproxscena;
public Scrollbar barrinha;
// Referencias
public Transform groundCheck;
public LayerMask groundMask;
// Use this for initialization
void Start () {
health = 100;
}
// Update is called once per frame
void Update () {
TryMovement();
UpdateIsGround();
TryJump ();
verificarSeMorreu();
barrinha.size = health / 100;
}
void TryMovement() {
if(Input.GetKey (KeyCode.D) == true) {
this.transform.Translate (Vector2.right * Time.deltaTime * velocity);
}
if(Input.GetKey (KeyCode.A) == true) {
this.transform.Translate (Vector2.left * Time.deltaTime * velocity);
}
}
void UpdateIsGround () {
isGround = Physics2D.OverlapCircle (groundCheck.position,0.02f, groundMask);
}
void TryJump() {
if((Input.GetKeyUp (KeyCode.W) || Input.GetKeyDown (KeyCode.Space) == true) && isGround == true) {
this.GetComponent ().AddForce (Vector2.up * jumpPower);
}
}
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == “Finish”)
{
//SceneManager.LoadScene(nomeproxscena);
SceneManager.LoadScene(“Menu”);
}
if (collision.gameObject.tag == “Void”)
{
//SceneManager.LoadScene(SceneManager.GetActiveScene().name);
SceneManager.LoadScene(“GameOver”);
}
if (collision.gameObject.tag == “Bullet”)
{
Destroy(collision.gameObject);
health -= 50;
}
}
private void OnCollisionStay2D(Collision2D collision)
{
if (collision.gameObject.tag == “Enemy”)
{
health -= 1;
}
}
void verificarSeMorreu()
{
if (health <= 0)
{
SceneManager.LoadScene(“GameOver”);
}
}
void UpdateAnimaton () {
if (Input.GetKey(KeyCode.D) == true) {
this.GetComponent ().SetBool (“walking”,true);
this.transform.localScale = new Vector3 (1 , 1 , 1);
} else if (Input.GetKey(KeyCode.A) == true) if (Input.GetKey(KeyCode.D) == true) {
this.GetComponent ().SetBool (“walking”,true);
this.transform.localScale = new Vector3 (-1 , 1 , 1);
} else {
this.GetComponent ().SetBool (“walking” , false);
}
}
}