Help my brain (zoom to character)

Started by Alynn, Thu 03/08/2006 09:23:03

Previous topic - Next topic

Alynn

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.

SSH

Have a look at my Zoom module and see if it does what you want
12

Alynn

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.

SSH

12

Alynn

No compile with 2.72 SSH GetGameParameter no longer exists

Game.SpriteHeight
Game.SpriteWidth

So on and so forth :)

SSH

12

strazer

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".

SSH

12

Ashen

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?
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk