task 06

product

code:


Scene 1:


//   for text fade in over time
var op = 0;


function warnOp () {
	op += .045;
	op %= 60;
	warning._alpha = op;
}

_root.onEnterFrame = warnOp;


// to replace cursor with a baseball bat
batcursor.onEnterFrame = function() {
	this._x = _root._xmouse;
	this._y = _root._ymouse;
};


Mouse.hide();



// chinging orientation of the bat based on user input
function UserControl() {}

UserControl.onKeyUp = function() {
	var code = Key.getCode();
	switch(code) {

		case Key.DOWN :
		batbat.setDirection("SOUTH");
		break;

		case Key.UP :
		batbat.setDirection("NORTH");
		break;

		case Key.LEFT :
		batbat.setDirection("WEST");
		break;

		case Key.RIGHT :
		batbat.setDirection("EAST");
		break;
		
	}
};

Key.addListener(UserControl);

function setDirection(d) {
	orientation.gotoAndStop(d);
}

function startAction() {
	orientation.animate();
}


function animate() {
	pose.gotoAndPlay("eyego");
}