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

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • 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).

    Please login to see this attachment.

    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!

  • 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

    Join the Click Converse Discord! - Please login to see this link.

  • 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).

  • 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.
    Please login to see this link.

  • 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:
    Please login to see this picture.
    changing it to this fixes it:
    Please login to see this picture.

    - BartekB

    Join the Click Converse Discord! - Please login to see this link.

  • 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!Please login to see this attachment.Please login to see this attachment.Please login to see this attachment.
    As soon as I can I will reciprocate by sharing the tutorial I am creating, as soon as I have fixed it!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!