Auto Zoom?

For questions about using Classic.

Post » Mon Nov 08, 2010 6:41 pm

http://www.youtube.com/watch?v=t8qaSOc-gKc

Pretty likes this, expect what the Camera to zoom in as the player gets close to the enemy. I've seen that other one, but I'm using MagiCam/Advance Camera. So, if anyone has any idea, I'm open for it.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Mon Nov 08, 2010 6:53 pm

That's one of the things that I've been working to add to the MagiCam plugin. I'll look into finishing it up soon.
Moderator
B
97
S
36
G
19
Posts: 1,584
Reputation: 17,692

Post » Mon Nov 08, 2010 7:53 pm

Set the zoom based on the distance between the players.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Mon Nov 08, 2010 8:23 pm

Hmm. I'll Look in to that.
Doesn't seem to work. X Zoom works, but Y Zoom... seems to mess up.

I set X and Y Zoom at 50, and the camera spazzes out.

Also, it Zooms in as they are farther apart. I want it to zoom out the more apart they are from each other. I tried a negative number, but it flip the screen.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Mon Nov 08, 2010 8:57 pm

Even if you don't want to use the auto-zoom-engine, why not take a look? And then just copy the parts that do what you need :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Nov 08, 2010 9:35 pm

Just updated the MagiCam plugin with a zoom to fit feature. Check it out here.

In case you're curious, the way I handle it in the plugin is that I first find which objects are the farthest left, right, up, and down, with the respective X/Y coordinates specified as:

[code:3fhfk5h5]farLeft, farRight, farTop, forBottom[/code:3fhfk5h5]
The formula for figuring out the zoom value is then:

[code:3fhfk5h5]// Find the distance between the extreme horizontal and vertical positions
SpaceX = abs(farLeft - farRight)
SpaceY = abs(farTop - farBottom)

// Calculate what the zoom needs to be on each axis to encompass all objects
TempZoomX = WinWidth / (SpaceX + ((HorizontalMargin * 2) / (WinWidth / SpaceX))
TempZoomY = WinHeight / (SpaceY + ((VerticalMargin * 2) / (WinHeight / SpaceY))

// Find the smallest zoom value
FinalZoom = min(TempZoomX, TempZoomY)

// Set the zoom to the smallest zoom value
ZoomX = FinalZoom
ZoomY = FinalZoom[/code:3fhfk5h5]
Moderator
B
97
S
36
G
19
Posts: 1,584
Reputation: 17,692


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest