User Tag List

Results 1 to 9 of 9

Thread: I need help with math for rectangular touch zones instead of circular touch zones.

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Wodjanoi's Avatar
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    665
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    I need help with math for rectangular touch zones instead of circular touch zones.

    Due to this thread it's possible: http://community.clickteam.com/threads/80251-Movement-in-android

    touchzones.mfa

    Please take a look at this example with Multiple Touch object. For the circular/spherical touch zones it uses this:

    Sqr(( ( XTouch( "Multiple Touch", LoopIndex("isTouchActive" ) ) - X( "dpaddown" ) ) pow 2 ) + ( ( YTouch( "Multiple Touch", LoopIndex("isTouchActive" ) ) - Y( "dpaddown" ) ) pow 2 ) )

  2. #2
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,132
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    What exactly are you trying to achieve? You haven't really posed a question yet. Do you want a Touch D-Pad like in the example, only with rectangles?

    I made an example of multi-touch d-pad, seems to work better than the one you posted there.
    Attached files Attached files

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Wodjanoi's Avatar
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    665
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    DaveC, I know all your examples with multi-touch and they are all good but I'm just interested in that other method too.
    There are basically circular zones on the hotspot of the d-pad objects and I would like to know how to do rectangular or square zones.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    The expression above is "distance" from the center of the object (assuming hotspot of dpaddown is placed in the center of the object)
    distance makes for a circular zone because you basically have a "radius" from center.
    If you want a rectangular zone, I would guess you just need to test a "hitbox"
    (es.
    Xtouch >= Xdpad - 30
    +Xtouch <= Xdpad + 30
    +Ytouch >= Ydpad - 30
    +Ytouch <= Ydpad + 30)

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Wodjanoi's Avatar
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    665
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    This is how it works. Nice tip schrodinger!

    Edit: Actually it's not working - it's still a circular zone. I guess I misunderstood your post schrodinger.
    I'm unsure how to it now. Can you upload an example please?

    Thank you very much .

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Wodjanoi's Avatar
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    665
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)


    This was the code for the circular zone:
    Sqr(( ( XTouch( "Multiple Touch", LoopIndex("isTouchActive" ) ) - X( "dpaddown" ) ) pow 2 ) + ( ( YTouch( "Multiple Touch", LoopIndex("isTouchActive" ) ) - Y( "dpaddown" ) ) pow 2 ) )

    The left image shows how the circular zone looks with button size 10.
    Is it possible to do a square zone(middle image) instead of circular zone using a similar method/expression code?

    If this is not possible, how to manually set a rectangular zone as "hitbox" which works with Multiple Touch object?
    -----------------
    touchzones2.mfa
    -----------------

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Sorry I missed your edit in previous post!

    I don't see the square hitbox coded in your example, did I miss something?

    I was thinking at something like this:
    touchzones2_1.mfa

    (see "dpadup square" behavior)

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Wodjanoi's Avatar
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    665
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Now I get it. Thanks a ton!

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Glad to help

    of course for a rectangular zone you would just have to specify a different offset for horizontal/vertical coordinates

    i.e.
    Xtouch <= X +10
    Xtouch >= X -10
    Ytouch <= Y +30
    Ytouch >= Y -30

    would do for a 20x60 zone

Similar Threads

  1. Create onject with multiple zones
    By mr_mercury06uk in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th August 2013, 08:27 PM
  2. Build 14: Touch zones not working
    By Kisguri in forum iOS Export Module Version 2.0
    Replies: 4
    Last Post: 24th February 2011, 10:29 AM
  3. Zones and Scrolling Play area
    By Tuna in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd June 2009, 03:11 AM
  4. Please add Positional Zones.
    By 00J in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 13th September 2007, 05:07 AM
  5. TIME ZONES
    By dascribe in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 21st May 2007, 07:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •