Shrink objects in runtime

This forum is currently in read-only mode.
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hey there.

    I'm trying to shrink object so they fit in certain area of the layout.

    Basicly if you would look at the .cap you see what i'm talking about.

    If you make 25x25 array its should be ok. But if you would make 35x35 array it should shrink the boxes so they fit in the area that is fixed for them.

    The methods that i have been using, well they are just making construct crashing so i dont have a clue how to do this.

    Here is the file:

    http://www.internet.is/eski/shrink.cap

  • There's actually a really simple formula for this. The formula for finding the proper size is:

    AreaWidth / XObjectCount

    Since the size of the area you're filling is 400, simply divide 400 by the amount of objects placed along the X axis to get the necessary width for your objects. The width can be used for the height as well, unless you want to allow rectangular areas, in which case you would set the height to:

    AreaHeight / YObjectCount

    I hope this helps.

  • There's actually a really simple formula for this. The formula for finding the proper size is:

    AreaWidth / XObjectCount

    Since the size of the area you're filling is 400, simply divide 400 by the amount of objects placed along the X axis to get the necessary width for your objects. The width can be used for the height as well, unless you want to allow rectangular areas, in which case you would set the height to:

    AreaHeight / YObjectCount

    I hope this helps.

    The problem that i'm having is i want to scale the box down. This method works well but sometimes the boxes get streched out and then they look funky.

    The boxes are default 16x16 but if the level is lets say 30x30 then i should be 400 / 30 = 13,3 per height and width.

    I want to allow rectangular, like 35x15

  • I'd suggest using the box plugin instead of a sprite for the boxes. That not only allows you to scale the boxes without increasing the thickness of the edge, but it fixes the blurring associated with floating point sizes.

    For rectangular areas, I'd suggest setting the height of the objects to that of the width, just so all of the boxes are square.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'd suggest using the box plugin instead of a sprite for the boxes. That not only allows you to scale the boxes without increasing the thickness of the edge, but it fixes the blurring associated with floating point sizes.

    For rectangular areas, I'd suggest setting the height of the objects to that of the width, just so all of the boxes are square.

    mmm.. i cant make any changes on the box plugin...

    I'm using sprites because i have animation when you click on the box and when you deselect it..

    I'm real close to geting this, just trying to figure out how to use the OR and else commands.

    Its confusing, when using OR and ELSE should i add it as a sub event ?

  • No, not a sub-event.

    Or is used in the same condition block, like so:

    + Player is overlapping cheese
    + Or
    + Player is overlapping kangaroo
    [/code:38us93hx]
    
    The Else is a new event underneath the previous event.  Using else automatically creates a "pipe" to the event above it.  Like so:
    
    [code:38us93hx]
    + Player is overlapping cheese
    |
    + Else
    [/code:38us93hx]
    
    When you use Else, it should be a condition all by itself, since it is basically saying "whenever the above conditions aren't happening."
  • Dunno if this is fixed yet but Else used to bug out if you added subevents to it.

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