How do I scale parent and pinned objects

  • Hi

    my project is like crossword puzzle where i pin individual letters to large image that is empty crossword puzzle.

    i have problem when i want to scale that large image... all my letters lose their pin spots...

    how can i scale all my sprites like layout scaling does?

    any solutions to this problem?

  • woof... i recons you have a few ways to solve this.

    ideally i need to know if your scaling the background image on the construct 2 screen (in which case you are left to move things individually

    else, if you are scaling the background object in the game i need to know if the background is a single object

    you could add loads of image points on the background (grid i assume) then assign a variable to the pin points, on start up event set position THEN pin to the required image point

    or have an event that happens after the scaling is finished to reset letter positions to the image points

    i think if i was doing what you are doing, i'd have lots of sprites as background tiles. 2 colours, so if you have blacked out squares nothing will pin.

    if the image is white, it allows the clicking operation.

    on click letter tile, set a global variable to show what letter is selected, then on click a white square, add the variable to the white's own variable

    if white variable =1

    white spawn sprite(A) image point 1 ect

    i know this is more of how i would create the crossword than how to fix your problem. put pins are useless if not already in position, try an "anchor" guide also

    hope this helps, if your looking for a code to work out the increase in size relative to the position.... there are easier ways to set positions

  • You could just scale the layer the crossword is on.

  • R0J0hound

    Yes, that was mine first bet... than i realised that it dont work as one would expect so i reported a bug...

    https://www.scirra.com/forum/layer-scale-is-broken_t153679

    (i am using not just scale of layer but also a canvas snapshot in combination with its own resizing...)

  • irina

    If you scale the crossword by a factor "scale" you could do this:

    crosswordgrid: set size to (self.width*scale, self.height*scale)

    letter: set x to (letter.x - puzzlegrid.x)*scale + puzzlegrid.x

    letter: set y to (letter.y - puzzlegrid.y)*scale + puzzlegrid.y

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound

    Thanks!

    R0J0 saves the day once again!!!

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