Hey, sorry for the delay. Yeah, it’s really bothering me that I can’t get this one thing working. On my splash screen, pause menu, one interface button in game, item popping, and a moving camera/background, all have the same code…copy and pasted, and then modified for their needs. The splash screen, interface button, and background all work. The pause button and popping of items do not. The code below is for the iphone and is the code for the item popping that I cannot get to work.
function Update () {
if(isUpdating)
{
var rBody:Rigidbody = gameObject.GetComponent(Rigidbody) as Rigidbody;
if(rBody) {
var curMagnitude = rBody.velocity.magnitude;
if(curMagnitude > speedLimit) {
var forceMagnitude = curMagnitude - speedLimit;
if(forceMagnitude > 0 curMagnitude > 0){
var force:Vector3 = rBody.velocity * (-forceMagnitude);
rBody.AddForce(force);
}
}
}
if(!SquidgyToggle.isSquidgy !SquidgyToggle.isOnHUD Time.timeScale != 0.0)
{
var hit : RaycastHit;
for (var i = 0; i < Input.touchCount; ++i) {
if (Input.GetTouch(i).phase == TouchPhase.Began) {
// Construct a ray from the current touch coordinates
var ray = Camera.main.ScreenPointToRay (Input.GetTouch(i).position);
if (Physics.Raycast (ray, hit)) {
// Create a particle if hit
var hitObj:GameObject = hit.transform.GetComponent(GameObject) as GameObject;
if(hitObj == gameObject)
{
curClicks++;
if(curClicks == clicksToDestroy)
{
isUpdating = false;
DestroyBubble();
}
}
}
}
}
}
}
}
This is the pause menu that is not working:
function Update() {
if(MenuStates.curState != MenuType.PAUSE MenuStates.curState == MenuType.HUD)
{
var hit : RaycastHit;
for (var i = 0; i < Input.touchCount; ++i) {
if (Input.GetTouch(i).phase == TouchPhase.Began) {
// Construct a ray from the current touch coordinates
var ray = Camera.main.ScreenPointToRay (Input.GetTouch(i).position);
if (Physics.Raycast (ray, hit)) {
// Create a particle if hit
var hitObj:GameObject = hit.transform.GetComponent(GameObject) as GameObject;
if(hitObj == gameObject)
{
var squidgy:GameObject = GameObject.Find(“SquidgyButton”);
var squidgyTex:GUITexture = squidgy.GetComponent(GUITexture);
squidgyTex.enabled = false;
MenuStates.curState = MenuType.PAUSE;
Time.timeScale = 0.0;
}
}
}
}
}
}
This is the splash screen that IS working:
function Update () {
timeElapsed += Time.deltaTime;
for (var touch:Touch in Input.touches)
{
if(touch.phase == TouchPhase.Began)
Application.LoadLevel(“BubbleFactory”);
}
if(timeElapsed > 2.0)
Application.LoadLevel(“BubbleFactory”);
}
Thanks for any help you might be able to give me!!!