CenterObject(int object)

Started by Barcik, Thu 17/04/2003 14:57:44

Previous topic - Next topic

Barcik

I'd like to suggest the function in the topic. Similar to CenterGUI, except that it center objects.
Currently Working On: Monkey Island 1.5

Ishmael

I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

AJA

I presume you mean centering GUI objects, right?

Barcik

No, I do mean centering objects.
Currently Working On: Monkey Island 1.5

AJA

Room objects? But... May I ask you why you need to center room objects?

Barcik

Mostly for credits.

I do know a way to do this myself, but I think this can be useful to implement and it seems quite trivial to me.
Currently Working On: Monkey Island 1.5

AJA

Use Creditz plugin... by me... ;D

scotch

If anyone else wants to do it in the meantime, i used this script.

function CenterObject(int object,int widthofobject,int heightofobject)
{
int xp=(((320-widthofobject)/2)+GetViewportX());
int yp=(((200+heightofobject)/2)+GetViewportY());
SetObjectPosition (object, xp, yp);
}

I can't script well but it seems to work ok..

Pumaman

I can't really see this being useful enough to be added - after all, custard's script should do it. Is there a use for this that I'm not thinking of?

Barcik

In that case may I suggest GetObjectWidth and GetObjectHeight?
Currently Working On: Monkey Island 1.5

scotch

Heh, I was going to ask that, or at least get an image's height,  there's already a function to find which sprite an object is set to.
I can't really think of a real use for it though, unless you're setting the object image to a random sprite and you don't know the heights but that seems unlikely.

Privateer Puddin'

Quote from: CJ on Thu 17/04/2003 19:17:02
I can't really see this being useful enough to be added - after all, custard's script should do it. Is there a use for this that I'm not thinking of?

Thanks, but its not mine :)

scotch

I stole it from you and slightly modified it.
How did CJ know that?!

Pumaman

Quote from: custard on Fri 18/04/2003 13:04:23
Thanks, but its not mine :)

Err... sorry about that scotch, I must have had custard on the brain at the time. Mmmmmm, treacle pudding with custard.

*ahem* anyway, yes I think a GetSpriteHeight/Width would be useful, and you could use it in conjunction with GetObjectGraphic to do what you're asking here.

RickJ

How about characters?  Would GetCharacterGraphic() also be useful?

Pumaman

Possibly - but characters are altogether more complicated since they might be scaled, then the GetSpriteWidth wouldn't return the actual width of the character. Would anybody actually find a script function like that useful?

Scorpiorus

I find it pretty useful for doing imagesize-related stuff. I could use plugin API but implementing the function into AGS directly would help to keep the things portable. That's always handy to have one more Get*thingy* function. :P

-Cheers

SMF spam blocked by CleanTalk