How do I scale parent and pinned objects

Get help using Construct 2

Post » Fri Sep 11, 2015 2:33 pm

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?
Last edited by irina on Fri Sep 11, 2015 8:22 pm, edited 1 time in total.
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Fri Sep 11, 2015 6:47 pm

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
B
9
S
3
Posts: 102
Reputation: 987

Post » Fri Sep 11, 2015 8:17 pm

You could just scale the layer the crossword is on.
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Fri Sep 11, 2015 8:20 pm

@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...)
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Fri Sep 11, 2015 9:00 pm

@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
B
92
S
32
G
109
Posts: 5,291
Reputation: 70,993

Post » Sat Sep 12, 2015 8:44 am

@R0J0hound

Thanks!
R0J0 saves the day once again!!! :)
B
26
S
11
G
2
Posts: 669
Reputation: 5,038


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests