Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - blumpkinblake

Pages: [1]
1
Support / Re: Android touch input
« on: April 29, 2014, 02:58:15 am »
Now I have another issue,

There is only a sendmessage for on down, on up, on click, on release.

My current setup is a 2d game with a left button next to a right button

When I set on down to left_true and right_true respectively.
On up I set to left_false and right_false respectively

Code: [Select]
private void left_true()
    {
        left = true;
    }

    private void right_true()
    {
        right = true;
    }
   
    private void left_false()
    {
        left = false;
        Zero();
    }

    private void right_false()
    {
        right = false;
        Zero();
    }

In my fixed_update if left or right is true it will then move them

However, what I want is to be able to slide my finger from right to left and have it disable right and enable left.

The way it's working right now you have to let go of the screen and click on the next button.

I have a tk2duimanager with multitouch checked as well.

Is there a way to activate the onup by moving your finger off the button and activate the ondown for the other button without lifting your finger?

2
Support / Re: Android touch input
« on: April 28, 2014, 09:10:11 pm »
Perfect, it works!

The problem was: I was using a box collider 2d instead of a normal collider

Thankyou

3
Support / Android touch input
« on: April 27, 2014, 11:56:58 pm »
I have been searching everywhere looking for handling touchscreen inputs with tk2d.

My current setup is a button that consists of tk2dSprite with a tk2dUiItem. I don't have a collider on it since my Sprite will interact with the button which I don't want it to do.

I have my buttons (left, right, jump, pause) all connected to my camera so they stay in the same place on the screen with player movement.

Here is some code that I have tried:

Code: [Select]
foreach (Touch touch in Input.touches)
        {
            if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
            {
                if (_leftTexture.IsPressed)
                {
                    Move_Left();
                }
                if (_rightTexture.IsPressed)
                {
                    Move_Right();
                }

                if (_jumpTexture.IsPressed)
                    Jump();
            }
        }

The above code is in a c# movement script that I have made.

My _leftTexture and so on are defined as a public tk2dUiItem above so that I can set the in Unity.

I have tried the SendMessage in the Tk2dUiItem preferences to activate the function I want to do with no avail.


Pages: [1]