Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How should I go about creating a camera similar to what you’d see in a fighting game?

Asked by 3 years ago

So I’m creating a 2D Fighting game, and the progress is going well so far! Got some of the mechanics done, started animations a few hours ago, it’s going well. But one thing I can’t figure out on my own is creating the camera for it. You see, in fighting games, the camera will always be centered on the 2 fighters, and if the fighters get far away from each other, the camera will zoom out to make sure both fighters are visible, all while being centered on the 2 fighters. So how would I go about creating a 2D camera, that centers on 2 different players, while also zooming out if they get too far away to make sure both fighters are visible on screen? Despite getting a good chunk of my game done completely by myself, I can’t seem to think of a possible solution to creating a camera like this. So, I’d like to know how I can approach this situation, all help is appreciated!

0
It would be helpful of you if you could provide us with any attempts you have made for this to work, or any other script that could make it easier for us to help you. :) AntoninFearless 622 — 3y
0
I gotchu! So the first and only attempt I made was to weld one brick to each fighter, then Instance another brick, and set it’s position to be (Part1.Position + Part2.Position)/2 (Part1 and Part2 being variables of the parts that are welded to the players of course) and then had it update every frame, and made the focus object on the camera be that part. This could work but I wasn’t able to get it sammy1123123 0 — 3y
0
That’s the only attempt I’ve tried, it could def work but there’s probably a way better method out there. If you need the script for my first and only attempt I’ll def send it sammy1123123 0 — 3y

Answer this question