Search Unity

Script not doing anything

Discussion in 'Scripting' started by Unicorn437, Apr 20, 2014.

  1. Unicorn437

    Unicorn437

    Joined:
    Apr 20, 2014
    Posts:
    3
    Hey,
    I started on my new project today, a 2D tower defense game using the tutorial from unitycookie and tried running the game, just moving enemies into the range, but suddenly nothing happens. I wonder why that is. I attached the script used for the turret because I think it has to do with that. Can't really figure it out myself since I just started using Unity yesterday and am really new to javascript.
    I would really appreciate if someone could find the error,
    Crêak
     

    Attached Files:

  2. wondyr

    wondyr

    Joined:
    Nov 30, 2013
    Posts:
    36
    Think the problem is

    Code (csharp):
    1. function CalculateAimError()
    2. {
    3.     aimError = Random.Range(-errorAmount,errorAmount);
    4. }
    5.  
    Try replacing the -errorAmount with -.001f and see what happens. If that fixes it then add new var errorAmonutMin: float = -.001;
     
  3. Unicorn437

    Unicorn437

    Joined:
    Apr 20, 2014
    Posts:
    3
    wondyr suddenly it did not do anything.
     
  4. Unicorn437

    Unicorn437

    Joined:
    Apr 20, 2014
    Posts:
    3
    Changed a lot regarding the objects, including a switch to 3D, now it seems to work but I run into some other issues: only 1 barrel of 2 fires while both are defined as Muzzle Positions and it does not rotate correctly.