User Tag List

Results 1 to 7 of 7

Thread: How to make an object always the same pixel size as another relative object

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export ModuleUnicode Add-on
    daryuss's Avatar
    Join Date
    Apr 2012
    Location
    Italy
    Posts
    241
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to make an object always the same pixel size as another relative object

    How do I make the pixel size always equal to the size of another object?
    For example. I create a visible object which is the one moved by the player.
    Then I create a collision sensor object which must always be in the same xy position as the visible object.
    If I want the sensor object always keep its same number of pixels x, while its number of pixels y is always the same as the number of pixels y of its relative object, frame by frame, like in picture, what's the formula?
    (It is different from the scale, which works only as a percentage).

    SENSOR_RESIZE_AUTOMATICALLY.jpg

    The formula I tried is this:

    Always set y scale "collision sensor" to Exp(Image( "Fighter: Ryu Moving" )) + YScale( "Fighter: Ryu Moving" ) - Exp(Image( "Fighter: Ryu Moving" )) * 0.99

    But the result is not achieved!

  2. #2
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    If the sprite active object's animation is correctly clipped so that there is no transparent borders. It's easy as retrieving OHeight("Active") from the active.
    To make it work for scale, you'll have to divide OHeight by the original height of the collision box. Make sure you pass decimals somewhere before the division so Fusion recognises this as a float (number with decimals) rather than an integer: OHeight * 1.0 / original_col_height

    If the sprite does have bounds, unfortunately it won't be as easy, since you now have to run overlap events through a fastloop to check where a horizontal line in the sprite is empty.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  3. #3
    Clicker Fusion 2.5 DeveloperiOS Export ModuleUnicode Add-on
    daryuss's Avatar
    Join Date
    Apr 2012
    Location
    Italy
    Posts
    241
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks.
    I will try to do what you explained to me. However, with the formula I posted, I got a little closer to the purpose. The fact is that it happens the other way around: for example, when you run animation 4 of the figure, which is the smallest, (61 pixels vertically) it happens that the sensor object grows vertically instead of shrinking!
    (That "Exp" of the formula, should mean "Expansion", and then I specified that it must consider the Y scale, The x scale must not change in size).

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export ModuleUnicode Add-on
    daryuss's Avatar
    Join Date
    Apr 2012
    Location
    Italy
    Posts
    241
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi. Trying as you explained to me, I succeeded in my intent simply by making the sensor one pixel high and formulating:
    Always - set scale ("Collisions sensor") to OHeight ("Fighter: Ryu Moving")
    But the problem is that it resizes from the hot spot downwards! (Click team fusion by default orients the y coordinates from top to bottom).
    I would like to explain to computer he has resize the object from the hotspot upwards!
    I placed the two lines of code at the start of the event editor.
    Here is the example.

  5. #5
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Then move the hotspot of the box down by 1 pixel. The origin is not a pixel in size, but rather the top/left coordinate of the "center" pixel while you edit the hotspot:

    changing it to this fixes it:
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  6. #6
    Clicker Fusion 2.5 DeveloperiOS Export ModuleUnicode Add-on
    daryuss's Avatar
    Join Date
    Apr 2012
    Location
    Italy
    Posts
    241
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    WOW! Thanks 1000!
    You have no idea how many trials I went through to get there!
    So there is no need to make as many sensor frames as there are for animation sprites.
    You are great, you are very smart! Sincere congratulations!medal.jpgmedal.jpgmedal.jpg
    As soon as I can I will reciprocate by sharing the tutorial I am creating, as soon as I have fixed it!

  7. #7
    Clicker Fusion 2.5 DeveloperiOS Export ModuleUnicode Add-on
    daryuss's Avatar
    Join Date
    Apr 2012
    Location
    Italy
    Posts
    241
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    @BertekB: This is the tutorial (or example) I am doing.

    Street Fighter tutorial freak!

    Thanks again for answering my question!

Similar Threads

  1. Replies: 5
    Last Post: 11th May 2015, 11:30 PM
  2. How would you move an object in straight line pixel by pixel from location to another
    By Tsun in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 22nd December 2012, 10:38 PM
  3. How to make an object always stay at a position relative to another object when yo...
    By StardustSpeedman in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 2nd June 2012, 01:13 PM
  4. Relative sub-pixel movement
    By Nifflas in forum Widgets
    Replies: 6
    Last Post: 2nd February 2010, 12:32 PM
  5. Replies: 1
    Last Post: 30th December 2009, 01:56 AM

Posting Permissions

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