shrink to fit

Get help using Construct 2

Post » Sun Mar 09, 2014 1:38 pm

Message: hopr37 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I have some sprites that are created at normal size at random locations. ( we'll call these locations "areanormal"
That works perfect.

However, I have created a few new locations that have a smaller diameter ( we'll call these locations "areashrink". I would like to have the same sprites to also randomly appear at these other locations but have them shrink to the size of the locations.
Included a little graphic to show what I mean.

https://db.tt/T5Zy3pPa
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sun Mar 09, 2014 2:10 pm

Well, first off do you want to reference those locations "areashrink" by coordinates or by object (say an invisible square)?

On the actions side you can have an object spawn an object or you can do an action where the system creates an object at a coordinate, then under that action select the object type and set scale.
B
19
S
7
G
7
Posts: 88
Reputation: 4,102

Post » Sun Mar 09, 2014 2:19 pm

Thanks for replying
by invisible squares. ( "areanormal" and "areashrink".
Not sure how to do this properly.
I have set scale manually but I am trying to have the program do it automatically.
So basically I have something like this:

" pick a random "areanormal"
create object on layer 0 at (areanormal.x, areanormal.y)

This works as intended.

However, I wish to have it also do this:
" pick a random "areashrink"
create object on layer 0 at (areashrink.x, areasshrink.y)
BUT ALSO DO THIS
if the object is located at "areashrink", have the object scale down to be the same size as areashrink

I can set size of the object like this: set size to (shrinkarea.x, shrinkarea.y)
but it actually enlarges the image...strange

update: added shrinkarea.x/2, shrinarea.y/2 and that seems to "kind of" work. However that works on only 1 sprite.
Do I have to add the same condition to all the sprites?
Maybe add a variable?

update2:
I have multiple "shrinkareas"
On one of them, the sprite scales correctly when on top of the shrinkarea but on the other it warps the dimensions of the sprite
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sun Mar 09, 2014 3:34 pm

Image
B
19
S
7
G
7
Posts: 88
Reputation: 4,102

Post » Sun Mar 09, 2014 6:15 pm

sorry TheDoctor.
but it needs to happen while it's been called to the "areashrink" object.
That doesn't do anything.
and I need to to effect all sprites so that if a certain sprite is in the "areanormal" location then it is normal size and if the same sprite goes is in the "areashrink" location it shrinks to the size of "areashrink"

something like if /then
if sprite is in "areanormal" then sprite = normal size
if sprite is in "areashrink" then sprite = shrink to "areashrink" size.

I'll figure it out. I know it's possible just don't have the right expressions.
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sun Mar 09, 2014 6:57 pm

ok
I've eliminated the 'areashrink" objects.
I didn't really need them since I can randomly spawn all my sprites to just the "areanormal" object.
That should make things easier ( for me)
So now what I want to do is resize a few of the "areanormal" objects to a smaller size and still have any of the sprites randomly appear on one of them but IF one of the sprites does land on one of the smaller objects then shrink the sprite to be the same size as the smaller object.

Does that make sense?
All any sprites can be randomly generated to different "areanormal" object locations ( I have about 6 of them). Some are bigger than others.
Depending on the size of the "areanormal" object, the sprite will expand or shrink to be the same size.
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Sun Mar 09, 2014 9:06 pm

Got it to work. Sort of
had to recreate the "areashrink" and place it over the "areanormal" so that if a random sprite was over the areashrink object, the set scale function would shrink it in half

Not a perfect solution but it's workable.

I would still like to be able to only have to use 1 invisible object tho
B
7
S
2
Posts: 158
Reputation: 1,021


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 7 guests