9 patch has broken cords

0 favourites
  • 5 posts
  • Problem Description

    Can not find the X and Y of the 9 patch... System cant seem to find it either.

    In the enclosed file I made it try to place the 9 patch where ever there is a Hold or right-click.

    System only seems to return 0,0 as the 9patch cords.

    Attach a Capx

    [attachment=0:22hggr5w][/attachment:22hggr5w]

    Description of Capx

    Rightclick or do a hold gesture to make system spawn 9patch... it should be at touch.x and touch.y... it will probably add the 9 patch to the top left corner. (0,0)

    Steps to Reproduce Bug

      load capx run capX rightclick anywhere Observed Result 9patch draws at 0,0 Expected Result patch to draw at 0,0 Affected Browsers
      • Chrome: (YES)
      • NodeWebkit: (YES) Operating System and Service Pack Win 7 Current SP (auto update is on) Construct 2 Version ID 195 , the current stable release Other Thanks in advance.
  • I believe it is a problem with your events. I downloaded the example, ran it and got the result you did. I then removed the event and recreated it with just a mouse click setting the 9 patch to the mouse location. It worked just fine. I then changed it to a Touch event and used the Touch coordinates. Again, it worked just fine.

    You can see this is the case simply by disabling the two conditions for the second event and using a simple On Any Touch Start event.

    See the attached modified .capx.

    I will say, you are using a Touch and a Mouse event to control the same action. This can cause a problem because, when the mouse event triggers, there are no Touch coordinates so the 9 patch would be placed at position 0, 0. Since you are using the Touch coordinates to set the position of the new 9 patch object, this is probably what is causing your event to produce a wrong result. The On Hold Gesture Over event doesn't appear to do anything.

  • you are using a Touch and a Mouse event to control the same action. This can cause a problem because, when the mouse event triggers, there are no Touch coordinates so the 9 patch would be placed at position 0, 0. Since you are using the Touch coordinates to set the position of the new 9 patch object, this is probably what is causing your event to produce a wrong result.

    Thanks so much. I never knew that we could not mix and match them ,

    I will do some sort of mouse or touch detection at start-up so I do not use a touch and a mouse sensor running at the same time.

    Thanks again FragFather!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Closing as not a bug: you retrieve the Touch object co-ordinates in a mouse event. These are separate. In a mouse event you need to use Mouse.X/Y and in a touch event you need to use Touch.X/Y.

  • Thanks Ashley!

    Sorry about the mixup

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)