move around

freedom!!!
all bugg is gone :smile:
thanks a lot:smile:
:smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile:

Syntax and naming is important. Allways double check your code and debug using the console window.
That will allways show you where to start your debug.

okey

well now the error code say

Assets/movearond.js(51,6): BCE0044: expecting :, found ‘=’.

its problem at dead = false; but I cant get it right even when I have look what the error code says
and my script is


//Moving around
var speed = 3.0;
var rotateSpeed = 3.0;

//Shooting
var bullitPrefab:Transform;

//Dying
private var dead = false;

//Geting hit
var tumbleSpeed = 800;
var decreaseTime = 0.01;
var decayTime = 0.01;
static var gotHit = false;
private var backup = [tumbleSpeed, decreaseTime, decayTime];

function LateUpdate()
{
if (dead)
{
transform.position = Vector3(0,4,0);
gameObject.Find(“Main Camera”).transform.position = Vector3(0,4,-10);
dead = false;
}

if(gotHit)
{
if(tumbleSpeed < 1)
{
//we’re not hit anymore… reset get back in the game!
tumbleSpeed = backup[0];
decreaseTime = backup[1];
decayTime = backup[2];
gotHit = false;
}
else
{
//we’re hit! Spin our character around
transform.Rotate(0,tumbleSpeed * Time.deltaTime,0, Space.World);
tumbleSpeed = tumbleSpeed-decreaseTime;
decreaseTime += decayTime;
}
}
}

function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == “fallout”);
{
dead = true;
//substract life here
HealthControll.LIVES -= 1;
}

if (hit.gameObject.tag == “fiendeball”)
{
gotHit = true;
}
}

function Update ()
{

var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);

var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);

controller.SimpleMove(forward * curSpeed);

if(Input.GetButtonDown(“Jump”))
{
var bullit = Instantiate(bullitPrefab,GameObject.Find(“spawnpoint”).transform.position,Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 2000);
}
}

@script RequireComponent(CharacterController)

//txzzo

do anny one know whats wrong whiv my script???
I cant find it :S
well I know where it is but not what it is…

Like i said, syntax is very important.

function OnControllerColliderHit(hit : ControllerColliderHit) 
{ 
   if(hit.gameObject.tag == "fallout"); 
   { 
      dead = true; 
      //substract life here 
      HealthControll.LIVES -= 1; 
   }
}

the syntax should be :

if(something)
{
   do this;
}

Very simple.
Allways make sure your syntax is right or you will be debugging typos all the time and those can be hard to find.

what??
i dont understand what to change.

sorry I dont under stand english weary well :S

if(hit.gameObject.tag == “fallout”);

should be

if(hit.gameObject.tag == “fallout”)

NO “;” at the end of an if statement.

no more errors now :smile:
but some thing must be wrong whiv my script anny way
well ty :smile:

no error and my spin dose dont work :shock: :?

my script is

//Moving around
var speed = 3.0;
var rotateSpeed = 3.0;

//Shooting
var bullitPrefab:Transform;

//Dying
private var dead = false;

//Geting hit
var tumbleSpeed = 800;
var decreaseTime = 0.01;
var decayTime = 0.01;
static var gotHit = false;
private var backup = [tumbleSpeed, decreaseTime, decayTime];

function LateUpdate()
{
if (dead)
{
transform.position = Vector3(0,4,0);
gameObject.Find(“Main Camera”).transform.position = Vector3(0,4,-10);
dead = false;
}
}

if(gotHit)
{
if(tumbleSpeed < 1)
{
//we’re not hit anymore… reset get back in the game!
tumbleSpeed = backup[0];
decreaseTime = backup[1];
decayTime = backup[2];
gotHit = false;
}
else
{
//we’re hit! Spin our character around
transform.Rotate(0,tumbleSpeed * Time.deltaTime,0, Space.World);
tumbleSpeed = tumbleSpeed-decreaseTime;
decreaseTime += decayTime;
}
}

function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == “fallout”)
{
dead = true;
//substract life here
HealthControll.LIVES -= 1;
}

if (hit.gameObject.tag == “fiendeball”)
{
gotHit = true;
}

}

function Update ()
{

var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);

var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);

controller.SimpleMove(forward * curSpeed);

if(Input.GetButtonDown(“Jump”))
{
var bullit = Instantiate(bullitPrefab,GameObject.Find(“spawnpoint”).transform.position,Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 2000);
}
}

@script RequireComponent(CharacterController)


please help me I have no idea what this can be now :? :? :? :? :?

then you should start debugging your code by using the Debug.Log() command.
for example :

if(gotHit) 
{
   Debug.Log("we got hit");
   if(tumbleSpeed < 1) 
   {
      Debug.Log("our tumblespeed is less then 1");
      //we're not hit anymore... reset  get back in the game! 
      tumbleSpeed = backup[0]; 
      decreaseTime = backup[1]; 
      decayTime = backup[2]; 
      gotHit = false; 
   } 
   else 
   {
      Debug.Log("our tumblespeed is more then 1");
      //we're hit! Spin our character around 
      transform.Rotate(0,tumbleSpeed * Time.deltaTime,0, Space.World); 
      tumbleSpeed = tumbleSpeed-decreaseTime; 
      decreaseTime += decayTime; 
   } 
}

and work your way through your code.
Also when you paste code in the forums, use the code button at the top when you paste.

where are im gonna place Debug.Log in my script?

I already did it for you.
I think you really need to read about scripting more.

yes,
but if im gonna de bugg on a other place beacuse it don’t find anny error there?

exactly what you need to learn, you will need to debug everything at some point. it’s part of the process.

wrote the script again so now it work…
where can i learn about debugg my script?

what dose this mean??
well its some thing whiv my OnControllerColliderHi
but I dont find what :?

OnControllerColliderHit couldn't be called because the expected parameter ControllerColliderHit doesn't match Collider.
UnityEngine.CharacterController:SimpleMove(Vector3)
UnityEngine.CharacterController:SimpleMove(Vector3)
movearond:Update() (at Assets\movearond.js:73)

[..\..\Runtime\Mono\MonoBehaviour.cpp line 1383]

well Im a n00b so I wanna learn more…
and I cant find this problem… :frowning:

//txzzo

The parameter you declare for your OnControllerColliderHit function must be of type ControllerColliderHit. From the error, it seems you have declared as a Collider instead.

the error is gone but I cant move my worm

anny one know whats wrong??