Games How we simulate a zooming feature during the game loop?

Gunther

Active Member
Licensed User
Longtime User
We can set our "zoom" when we set our dimensions before the X2.Start is given.

It looks ugly when a change to it is done within the game loop.

We can also change the size of objects as done with Mario in the Mario Example.
We can also load a graphic to an already loaded/used body which centers the graphic over the fixture.

But a real zoom feature I didn't found anywhere.

Do we have something like a zoom or how we can get a zoom into or out of a tilemap?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
But a real zoom feature I didn't found anywhere.
This is indeed missing from the X2 framework. I do hope to add better support for zoom in the future.

In the meantime try the attached example.

It changes ivForeground / ivBackground sizes to create a zoom effect.
 

Attachments

  • TankWithZoom.zip
    81.7 KB · Views: 412

Gunther

Active Member
Licensed User
Longtime User
You are right. It is close to a zoom but unfortunately the animation starts from the screen center.

But it could be used as "something like a zoom".

A camara object would be good. ;o)
 

Gunther

Active Member
Licensed User
Longtime User
Well, I tried to get the ground attached to the bottom screen edge but any math did worked since with giving the command of ivForeground.SetLayoutAnimated the ivForeground jumps to the given left and top and than starts the animation of scaling the width and height.

Of cause I changed the Duration to 5000 but this looks like it is only for the scaling not for the location change.
 
Top