shrink to fit

0 favourites
  • 7 posts
  • 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.

    db.tt/T5Zy3pPa

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

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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

  • 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

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