#
# Timer for dino
#

Object	obj = getThisObject();
int	tick = getObjectVar(obj, 0);
int	wantedTick = getObjectVar(obj, 1);

if (objectOnGround(obj))
{
	if (getObjectOrientation(obj) == ORIENTATION_LEFT)
		applyForce(obj, 0.0-1.5, 0.0);
	else
		applyForce(obj, 1.5, 0.0);
}

if (tick >= wantedTick)
{
	if (objectOnGround(obj))
	{
		if (randi(0, 100) > 50)
		{
			float	o;
			if (getObjectXPosition(getHero()) >
				getObjectXPosition(obj))
				o = 0.0-5.0;
			else
				o = 5.0;
			o = o*rand()*2.0;
			unsetObjectOnGround(obj);
			applyForce(obj, o, 0.0-4.0-rand()*4.0);
			playSample(makeCode("woof"));
		}
		flipObjectOrientation(obj);
	}
	setObjectVar(obj, 1, randi(30, 70));
	tick = 0;
}

setObjectVar(obj, 0, tick + 1);

