[TIP] - Auto resize actor properly

HunnenkoenigHunnenkoenig Member Posts: 1,173
edited November -1 in Working with GS (Mac)
I needed something, where my image gets resized only knowing the new height value.

I spawn an actor by another one and I wanted to set the height of the spawned actor according to the size of the spawner actor.

Now I made a game attribute with the height of the spawner (change or constrain) and in the spawned actor I made an old height/old width attribute (integer) with the original values.

Then I used change attribute self.size.height to game.spawner-height

and self.size.width to (old width / old height)*game.spawner-height

With this formula I get my actor resized in the proper way and have no worries about the actor being stretched or so...

Maybe it helps somebody.

Comments

  • design219design219 Member Posts: 2,273
    I'm going to have to start copying and pasting these tips into a document. I don't need this now, but someday I'm sure I will... and will not be able to find this thread.
  • adadoadado Member Posts: 219
    You could bookmark it in your web browser or use the "Add this topic..." link in the upper-right part of the GS forum web page. ;-) But if they ever go to a new forum format, then yeah, those may break. Carry on.
Sign In or Register to comment.