Penelope TapControl Tutorial issues

Hey guys,

I’m trying to write the TapControl script in the Penelope demo, but I keep getting errors that I don’t understand. I have gotten it this far:

enum ControlState {
	WaitingForFirstTouch,
	WaitingForSecondTouch,
	MovingCharacter,
	WaitingForMovement,
	ZoomingCamera,
	RotatingCamera,
	WaitingForNoFingers,
}

var minimumTimeUntilMove = 0.25;
var zoomEnabled : boolean = true;
var zoomEpsilon : float = 25;
var rotateEnabled : boolean = true;
var rotateEpsilon : float = 10;

private var state = ControlState.WaitingForFirstTouch;
private var fingerDown : int[] = new int[2];
private var fingerDownPosition : Vector2[] = new Vector2[2];
private var fingerDownFrame : int[] = new int[2];
private var firstTouchTime : float;

function ResetControlState()
{
	state = ControlState.WaitingForFirstTouch;
	fingerDown[0] = -1;
	fingerDown[1] = -1;
}

function Start()
{
	ResetControlState();
}

function OnEndGame()
{
	this.enabled = false;
}

function Update()
{
	var touchCount : int = iPhoneInput.touchCount;
	
	if (touchCount == 0)
	{
		ResetControlState();
	}
	else
	{
		var i: int;
		var touch = iPhoneTouch;
		var touches = iPhoneInput.touches;
		var touch0: iPhoneTouch;
		var touch1: iPhoneTouch;
		var gotTouch0 = false;
		var gotTouch1 = false;
		
		if (state == ControlState.WaitingForFirstTouch)
		{
			for (i = 0; i < touchCount; i++)
			{
				touch = touches[i];
				if (touch.phase != iPhoneTouchPhase.Ended 
				touch.phase != iPhoneTouchPhase.Canceled)
				{
					state = ControlState.WaitingForSecondTouch;
					firstTouchTime = Time.time;
					fingerDown[0] = touch.fingerId;
					fingerDownPosition[0] = touch.position;
					fingerDownFrame[0] = Time.frameCount;
					break;
				}
			}
		}
		
		if (state == ControlState.WaitingForSecondTouch)
		{
			for (i = 0; i < touchCount; i++)
			{
				touch = touches[i];
				if (touchCount >= 2  touch.fingerId != fingerDown[0])
				{
					state = ControlState.WaitingForMovement;
					fingerDown[1] = touch.fingerId;
					fingerDownPosition[1] = touch.position;
					fingerDownFrame[1] = Time.frameCount;
					break;
				} 
				else if (touchCount == 1)
				{
					var deltaSinceDown = touch.position - fingerDownPosition[0];
					if (touch.fingerId == fingerDown[0] 
					(Time.time > firstTouchTime + minimumTimeUntilMove || 
					touch.phase == iPhoneTouchPhase.Ended))
					{
						state = ControlState.MovingCharacter;
						break;
					}
				}
			}
		}
		
		
	}
}

but I’m getting lots of errors, even though its exactly what the tutorial said to script!

I’m getting Cannot convert ‘UnityEngine.iPhoneTouch’ to ‘System.Type’. as well as lots of errors like:

‘phase’ is not a member of ‘System.Type’.
‘fingerId’ is not a member of ‘System.Type’.
‘position’ is not a member of ‘System.Type’.

etc. What am I doing wrong? Thanks in advance!

Chowderman

If I remember correctly from when I did that tutorial, there were some words that were capitalized that shouldn’t have been and some that weren’t that should have been. Try to reference what you have against the completed tutorial since that one doesn’t come back with errors.