Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alynn on Thu 03/08/2006 09:23:03

Title: Help my brain (zoom to character)
Post by: Alynn on Thu 03/08/2006 09:23:03
I'm at work, so I can't actually test anything on AGS however I have been thinking of psudocode to use to do what I want... so I'll explain.

My character carries his inventory in his body, what I would like is when inventory is chosen, either A, the camera zooms to the characters body where the INV gui will then appear (and when inv window is closed the camera zooms back to normal position). or the alternate. The character zooms to the camera getting larger and larger until he takes up the whole screen and then the gui appears.

So in other words, this is a global type zoom, usable pretty much anywere that the player can open up the characters inventory.

I have two threads of thought on this... one is to use rawdraw to zoom, as suggested on other parts of the forums, however, since there will be some manipulation in trying to move the screenshot to move the character to the center of the screen as it zooms in, it may be more difficult than needed just for a single sprite... Second issue, my character sprites are Anti Aliased... so it would generally look nasty because if I remember right rawdraw isn't antialiased.

Second thought is to have the character sprite on the gui itself, and move and resize the gui to get the same sort of effect... the issues with this approach is having 2 instances of the character on screen at once and the number of background sprites for the gui I would need to make it work nicely.

So anyway... What I have so far is (psudo code)

function ShowInv(){
//center of the screen
int centX = ViewportX +160;
int centY = ViewportY +120;
//pixel change between player and center
int deltaX = player.X - centX;
int deltaY = player.Y - centY;

Get character loop frame 0 //for sprite to manipulate

while loop // most likely to loop until final size is reached, say width of screen
increase size by X%
int spriteCentX = centX  -  get width of rawdrawn sprite /2
int spriteCentY = centY - get height of rawdran sprite/2
move toward spriteCent by 1 pixel //both x and y coords
RawDraw it
end loop
gInvGUI.Visible = true;

And basically do the opposite to close the gui up... making the gui is basically the same, except it's easier to center the thing, and every resize of the gui assigns a new background sprite to the gui.

As an idea would this work, or in your experience is something like this more difficult to code than it is worth? Have you done something like this before that has worked?

I'd like to have an idea before I get home today and start messing with it. I don't need you to code it for me, I just wonder if I'm even thinking correctly on how to even attempt this.

Thanks.
Title: Re: Help my brain (zoom to character)
Post by: SSH on Thu 03/08/2006 09:58:37
Have a look at my Zoom module and see if it does what you want
Title: Re: Help my brain (zoom to character)
Post by: Alynn on Thu 03/08/2006 13:27:47
Bah, if I use that module that means there are 3 modules of yours I'm using (2 of my own, although one is a util module) and one of supsuper...

Odd though, my first few searches never came up with the thread... then again I didn't put module in it...

Anyway I'll check it out tonight and see how it does.
Title: Re: Help my brain (zoom to character)
Post by: SSH on Thu 03/08/2006 14:23:31
Thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23664.0)

Documentation  (http://ssh.me.uk/parsemodzip.php?modfile=Zoom.zip)
Title: Re: Help my brain (zoom to character)
Post by: Alynn on Thu 03/08/2006 17:01:20
No compile with 2.72 SSH GetGameParameter no longer exists

Game.SpriteHeight
Game.SpriteWidth

So on and so forth :)
Title: Re: Help my brain (zoom to character)
Post by: SSH on Thu 03/08/2006 21:34:14
I blame CJ
Title: Re: Help my brain (zoom to character)
Post by: strazer on Thu 03/08/2006 22:33:08
Quote from: Alynn on Thu 03/08/2006 17:01:20No compile with 2.72 SSH GetGameParameter no longer exists

Until SSH improves his module to handle v2.72, I think you can simply uncheck "Enforce object-oriented scripting".
Title: Re: Help my brain (zoom to character)
Post by: SSH on Fri 04/08/2006 09:54:32
Fixed it.
Title: Re: Help my brain (zoom to character)
Post by: Ashen on Fri 04/08/2006 14:55:37
No more module talk - that's what its thread is for.

Alynn, do you think the module has sorted this for you, or are you still looking for suggestions?