zoom background it's possible?

Started by katie08cd, Sat 21/04/2018 18:14:33

Previous topic - Next topic

katie08cd

i need in my game (room brain) the background change size

my idea: background 820x660 enter in room in fade in and change size (very slow) to 800x600 and after return 820x660 (very slow), what command should I use?

thanks, and sorry for my english

morganw

I don't think there is an easy way to zoom in the view of the entire screen, so the easiest approach may depend on what is visible in the room when you enter. If you definitely need to zoom in, you would probably have to do that manually by using an object in place of the background and then scaling it (if you look in the manual for DrawingSurface, that would help with anything to do with advanced drawing). If you are more interested in the change of size rather than zooming in, it would probably be easiest to slide in black borders from the sides (10 pixels on the left and right and 30 pixels on the top and bottom). As another alternative, you could render any animation you want as a video file, and just play that back after the room has faded in.

Danvzare

One way to do it that comes to my mind, would be to import the background with all of the objects and characters visible, as a sprite. Then assign that sprite to a new character, and set the scaling of a new blank room so that the "background" character starts off slightly small, and then gets slowly bigger. Then all you need to do is switch to the actual room that it's zooming into after it's finished, and the crossfade should trick the player into thinking they just saw that room actually zoom in.

The only downside is that you can't move while it's zooming in, and you have a lot of editing to do if you want to change anything in that room.

katie08cd

Quote from: Danvzare on Mon 23/04/2018 12:03:15
One way to do it that comes to my mind, would be to import the background with all of the objects and characters visible, as a sprite. Then assign that sprite to a new character, and set the scaling of a new blank room so that the "background" character starts off slightly small, and then gets slowly bigger. Then all you need to do is switch to the actual room that it's zooming into after it's finished, and the crossfade should trick the player into thinking they just saw that room actually zoom in.

The only downside is that you can't move while it's zooming in, and you have a lot of editing to do if you want to change anything in that room.

it was better if I could do it as an object, and then put it in a layer below, so that underneath me the background and I could give it a setsize, and the objects above could be seen, pity that you can not level the objects

Crimson Wizard

Quote from: katie08cd on Mon 23/04/2018 16:33:42
it was better if I could do it as an object, and then put it in a layer below, so that underneath me the background and I could give it a setsize, and the objects above could be seen, pity that you can not level the objects

You can level objects using Baseline property.
The lower Baseline is, the "farther" object is drawn.
Try setting Baseline to 1, then object will always be behind anything else.

katie08cd

Quote from: Crimson Wizard on Mon 23/04/2018 16:47:17
Quote from: katie08cd on Mon 23/04/2018 16:33:42
it was better if I could do it as an object, and then put it in a layer below, so that underneath me the background and I could give it a setsize, and the objects above could be seen, pity that you can not level the objects

You can level objects using Baseline property.
The lower Baseline is, the "farther" object is drawn.
Try setting Baseline to 1, then object will always be behind anything else.

ok baseline 1 work,I tried with a 20 frame view but I do not like the animation, I think you can not set a zoom level of the room that from 820x620 is reduced to 800x600 but slowly


Crimson Wizard

There are other ways to do this.

1) You may create a dummy character for background, set the image to it, and then change Character.Scaling property. You may need to use Timers for that to control speed of change (Look for the SetTimer in the manual).

2) You may simply draw an image on the room background using DrawingSurface, and change it in size gradually.
Check for the DrawingSurface and DrawingSurface.DrawImage in the manual.
Example:
Code: ags

DrawingSurface *ds = Room.GetDrawingSurfaceForBackground();
ds.DrawImage(-zoom_step, -zoom_step, SPRITE_NUMBER, 0, Game.SpriteWidth[SPRITE_NUMBER] + zoom_step * 2, Game.SpriteHeight[SPRITE_NUMBER] + zoom_step * 2);
ds.Release();

SPRITE_NUMBER is the number of sprite which has your background image.
zoom_step is a variable that you need to change by timer.

SMF spam blocked by CleanTalk