[SOLVED] How do I scale until all players are in view?

Get help using Construct 2

Post » Fri Oct 14, 2016 3:22 am

Hey guys.

I'm making a top-down local multiplayer racing game, but I have a problem, which I can't address. I need to make sure to place the camera between all of them (at the midpoint) and I scale the layout enough, so all players come into view and none of them is off-screen.

I managed to do the first, but I can't figure out how to know, when all players are in view and how to make a bulletproof scaling formula for that. Can anyone help on that?

Thanks!

EDIT: .capx file can be found here:
https://drive.google.com/file/d/0B3B2L_ ... sp=sharing
Last edited by dastmo on Fri Oct 14, 2016 5:31 pm, edited 1 time in total.
B
8
S
3
G
3
Posts: 18
Reputation: 2,186

Post » Fri Oct 14, 2016 12:18 pm

I just made this which should give some ideas... It zooms out until everything is in view, is that what you are after? Obviously you can adjust the values so that it is instant, I've just set it up to incrementally zoom out so you can see what's happening. https://dl.dropboxusercontent.com/u/495 ... nview.capx
B
47
S
18
G
84
Posts: 2,265
Reputation: 49,784

Post » Fri Oct 14, 2016 3:16 pm

Maybe try:

Player is on screen (to pick the players that are on screen)
-compare two numbers: picked count < player count
--every tick set scale to layoutscale - 0.01 (or however fast you want it to zoom out)

**off the top of my head—may not be foolproof
ImageImageImage
B
44
S
26
G
11
Posts: 518
Reputation: 10,502

Post » Fri Oct 14, 2016 5:30 pm

@plinkie - I can't open the file, since I still have version 233. I guess the Steam release is yet to be updated.

@badmoodtaylor - This actually sounds like a solid idea.

However, I found an easy fix, using MagiCam. I set the camera to follow all "players" and to set the zoom so all followed objects are in view.

Thanks a lot for the help to both of you! :)
B
8
S
3
G
3
Posts: 18
Reputation: 2,186

Post » Fri Oct 14, 2016 8:19 pm

No worries, my capx is pretty much the answer below mine, but looks like you have found a solution already :)
B
47
S
18
G
84
Posts: 2,265
Reputation: 49,784


Return to How do I....?

Who is online

Users browsing this forum: Diamond Dino 64 and 1 guest