Object origin/polling object size

Started by FortressCaulfield, Fri 07/06/2024 12:25:18

Previous topic - Next topic

FortressCaulfield

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.
"I can hear you! My ears do more than excrete toxic mucus, you know!"

-Hall of Heroes Docent, Accrual Twist of Fate

Laura Hunt

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.

FortressCaulfield

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!
"I can hear you! My ears do more than excrete toxic mucus, you know!"

-Hall of Heroes Docent, Accrual Twist of Fate

Crimson Wizard

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

SMF spam blocked by CleanTalk