I searched through my whole script but i cant find the problem.
Does anyone know whats going on with my script?
This is the full error:
Assets/player/Movement_Eiland.cs(4,14): error CS0101: The namespace global::' already contains a definition for Movement_Eiland’
using UnityEngine;
using System.Collections;
public class Movement_Eiland : MonoBehaviour {
public float size_y;
public float size_x;
public float Bardisplay;
public float Max_Stamina;
public float speed;
public float JumpStrength;
public bool JumpCounter;
public Texture2D Stamina;
public bool Sprinting;
public Texture2D Health;
public float HP;
public bool right;
public bool left;
public bool up;
public bool down;
public float size_xHP;
void Update () {
if (Bardisplay > Max_Stamina)
{
Bardisplay = Max_Stamina;
}
if (Bardisplay == 200)
{
Bardisplay = 200;
}
if(Bardisplay <= 0)
{
Sprinting = false;
}
if(Sprinting == true)
{
Bardisplay -= 50 * Time.deltaTime;
}
if(Sprinting == false)
{
Bardisplay += 16 * Time.deltaTime;
}
if(Input.GetKey("w"))
{
transform.Translate(Vector3.forward * speed * Time.deltaTime);
up = true;
}
else
{
up = false;
}
if(Input.GetKey("a"))
{
transform.Translate(Vector3.left * speed * Time.deltaTime);
left = true;
}
else
{
left = false;
}
if (Input.GetKey("d"))
{
transform.Translate(Vector3.right * speed * Time.deltaTime);
right = true;
}
else
{
right = false;
}
if (Input.GetKey("s"))
{
transform.Translate(Vector3.back * speed * Time.deltaTime);
down = true;
}
else
{
down = false;
}
if (Input.GetKeyUp("w"))
{
up = false;
}
if (Input.GetKeyUp("s"))
{
down = false;
}
if (Input.GetKeyUp("a"))
{
left = false;
}
if (Input.GetKeyUp("d"))
{
right = false;
}
if ( Sprinting == false down == false up == false right == false left == false)
{
Bardisplay += 32 * Time.deltaTime;
}
if (Input.GetKeyDown(KeyCode.Space) JumpCounter)
{
rigidbody.AddForce(Vector3.up * JumpStrength);
JumpCounter = false;
}
if (Input.GetKey(KeyCode.LeftShift) up == true)
{
Sprinting = true;
speed = 10;
}
if (Input.GetKey(KeyCode.LeftShift) down == true)
{
Sprinting = true;
speed = 10;
}
if (Input.GetKey(KeyCode.LeftShift) right == true)
{
Sprinting = true;
speed = 10;
}
if (Input.GetKey(KeyCode.LeftShift) left == true)
{
Sprinting = true;
speed = 10;
}
if (Input.GetKeyUp(KeyCode.LeftShift))
{
Sprinting = false;
speed = 5;
}
if (Input.GetKeyDown(KeyCode.LeftControl))
{
HP -= 5;
size_xHP -= 5;
}
if (HP <= 0)
{
Debug.Log("you are dead sucker >:smile:");
}
}
void OnCollisionEnter(Collision collision){
if (collision.collider.gameObject.tag == "floor")
{
JumpCounter = true;
}
}
void OnGUI()
{
size_x = Bardisplay;
GUI.DrawTexture(new Rect(900, 600, size_x, size_y), Stamina);
GUI.DrawTexture(new Rect(50, 600, size_xHP, size_y), Health);
}
}