Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: FortressCaulfield on Fri 07/06/2024 12:25:18

Title: Object origin/polling object size
Post by: FortressCaulfield on Fri 07/06/2024 12:25:18
Doing my credit sequence and made an object using frames for each part of the credits. However, because object positioning keys from bottom left pixel, placement looks wonky when different parts of the credits are different sizes.

Is there a way to force an object to use a different origin for placement? Ideally top center? To override the origin, so to speak?

Failing that is there a way for the script to access an object or frame's size? I could just tell the thing to adjust Y to Y + height. I expected there to be something like Object.Height but there isn't, just the blocking height which I have to set manually, so that's no good.

Apologies if this posts twice, forum gave me errors.
Title: Re: Object origin/polling object size
Post by: Laura Hunt on Fri 07/06/2024 12:51:35
Quote from: FortressCaulfield on Fri 07/06/2024 12:25:18Failing that is there a way for the script to access an object or frame's size? I could just tell the thing to adjust Y to Y + height. I expected there to be something like Object.Height but there isn't, just the blocking height which I have to set manually, so that's no good.

There isn't a direct Object.Height, but you can get the object's sprite using Object.Graphic, and then get this sprite's size using Game.SpriteHeight and Game.SpriteWidth.
Title: Re: Object origin/polling object size
Post by: FortressCaulfield on Fri 07/06/2024 13:11:30
Thanks I figured there was something like that but couldn't quite put it together. DLing the game in your sig now btw, looks incredible!
Title: Re: Object origin/polling object size
Post by: Crimson Wizard on Sat 08/06/2024 18:09:23
I am late to this, but might mention for the future reference, that there are alternatives to Room Objects, which have origin in top-left corner:
* GUI, with labels and buttons (buttons may display both images and texts); Because controls are clipped by the parent's edges, these may be used to create a text scrolling effect.
* Overlays: dynamically created in script, may have image or text, may be created in either UI or room "layer".
https://adventuregamestudio.github.io/ags-manual/Overlay.html