I’m having a huge headAche with this last line o coding that Im writing for my first game.
Its a character runing from one side to the other droping food. The first food e drops works just fine, the second on it just get HUGE.For some reason it just goes from 2.5 to 100 in size. Anyone has the faintest ideia of what’s going on?
public class dropFood1 : MonoBehaviour {
public float dropTimer;
public float coolDown;
public Transform target;
OTSprite food;
public OTContainer sheet;
private OTContainer frameset;
// Use this for initialization
void Start () {
GameObject go = GameObject.FindGameObjectWithTag("turista1");
target = go.transform;
dropTimer = 0;
coolDown = 6.0f;
}
// Update is called once per frame
void Update () {
if(dropTimer > 0)
dropTimer -= Time.deltaTime;
if(dropTimer < 0)
dropTimer = 0;
if(dropTimer == 0){
droparFood();
dropTimer = coolDown;
}
if(food){food.transform.position -= transform.up * 5 * Time.deltaTime;}
}
public void droparFood(){
frameset = new OTContainer();
frameset = sheet;
food = OT.CreateObject(OTObjectType.Sprite).GetComponent<OTSprite>();
food.spriteContainer = frameset;
}
}