Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Masked Guardian on Thu 05/03/2009 22:58:24

Title: Character resize function
Post by: Masked Guardian on Thu 05/03/2009 22:58:24
I've 3.1.2 SP1 version.

I supposed there isn't any resize character resize function, is there? :(

My problem is: I've created a character who is almost big as the room (640 x 480). I've imported many frames for a nice animation and it would be really boring to do all the process again (resizing, converting avi to bmp files e.t.c.)

No, i don't want to use the Manual scalling and Character.Scaling property, 'cause i intend to use this character to an area where i need an automatic room scaling.

The problem can be partially overcomed by adjusting the walkable area's scaling levels (eg from 10 up to 50) but that doesn't help in case i have to to resize another moving supporting character at the same time.

I think it would be very handy a character.resize function, with this it would be as i've imported the frames to the desired size (plus the quality will be better since the actual sprite images are high-res!)
Title: Re: Character resize function
Post by: Joe on Thu 05/03/2009 23:14:18
You can set the walkable area to the proper scaling percent in the walkable area properties list. ;)
Title: Re: Character resize function
Post by: Trent R on Thu 05/03/2009 23:15:35
There was a recent topic about this, but Scaling is the only way to go I believe. A character.resize would be very low priority since there's other ways to solve your problem (besides, you're being lazy and it'd be better in the long run to do it other ways.)

Few ideas: 1) Right click your sprites, 'Copy sprite to clipboard' then paste into your favorite program. Resize, Ctr-A, Ctrl-C, right click your sprite again, 'Replace sprite from clipboard'

2) Not sure (cause I don't use scaling) but can't you get the Scaling of the walkable area the character is currently on? You could then use this in conjunction with character.Scaling (I think this is what was done in the other thread)


[Edit]: The recent thread I mentioned, http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36553.0 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36553.0). Khris has a cool code in there too, and Gilbot links an old module that he wrote. Both would be good resources.
Also, the command I was thinking of is GetScalingAt



~Trent
Title: Re: Character resize function
Post by: Masked Guardian on Fri 06/03/2009 11:11:42
Ok, first of all thanks for your advices :)


I quote myself: "The problem can be partially overcomed by adjusting the walkable area's scaling levels (eg from 10 up to 50) but that doesn't help in case i have to to resize another moving supporting character at the same time."

Trent, if you have imported 120 frames then it will surely be a headache to resize each one of them and then re-import ;) But even if you use a program that resize at the same time many images, still the problem of quality remains if the scaling level of walkable area enlarges the character.

Anyway, thanks for the link, i think it will be useful :D
Title: Re: Character resize function
Post by: SSH on Fri 06/03/2009 11:56:39
I've just created a module that can resize the sprites of a character's views on the fly. I think this would be what you want. It does various other "distortions" too, and is the DistortChar module (http://ssh.me.uk/moddoc/DistortChar). I'll make a new thread for the module up soon...
Title: Re: Character resize function
Post by: Masked Guardian on Fri 06/03/2009 13:29:03
SSH your module looks really great, i will give it a try :) Congrats for your effort :D

For now i think KhrisMUC's code covers me for what i want to do (but i will use your module for more advanced things ;) ):

function Scale(this Character*, float factor) {
  if (this.Room != player.Room) return;
  if (!this.ManualScaling) this.ManualScaling = true;
  int s = FloatToInt(IntToFloat(GetScalingAt(this.x, this.y)) * factor);
  if (s<1) s = 1;
  if (s>200) s = 200;
  this.Scaling = s;
}


And to think that i had in my mind a similar code, but i stuck cause i wasn't aware about extender functions (it could be done without extender but it's a bit frustrated i think). AGS is really flexible!
Title: Re: Character resize function
Post by: Trent R on Fri 06/03/2009 19:55:02
Without an extender function, you could still use either an int (along with the character[] array) or a pointer.
function Scale (Character* toScale, float factor)
function Scale (int charID, float factor)



~Trent
Title: Re: Character resize function
Post by: Joe on Fri 06/03/2009 20:33:05
Anyway the extender function is nice, Trent, I think it would be good for your pseudo-module  :P wouldn't?
Title: Re: Character resize function
Post by: Trent R on Fri 06/03/2009 21:56:32
Yeah, and I'm just pointing out that there are other ways to do it. Sometimes, it won't work with an extender.


~Trent