This example is going to be of great use for everyone making local multi-player games, as well games requiring to display two objects on screen at once generally.
Effect here is, that view is positioned and scaled (if needed), to include two given instances at once.
Example provides a single function that does this sort of trick for you, absolutely painlessly and easily.
It looks like the link for the original .gmz no longer works.
Great work on the multi follow system. My tiled assets are tearing, what looks like every 200 pixels or so, when the camera zooms in and out. Any idea how to fix this? Is it a problem with drawing X and Y coordinates that are not whole numbers? Thank you!
There’s an official blog post about this in particular. There are also programs like Tileset Champion that can help to auto-modify the tileset.
I will have to check that out. So far i did a quick fix by adding a 1 pixel bleed in between the tiles and it looks good so far. Thanks for the quick reply!
How can i use this in studio 2? i tried it and there wasn’t any errors bu it didnt work.
You’ll have to import it into GMS 1.x first, and then import the GMS 1.x project into GMS2. Or study the manual to rewrite everything to use camera systems instead of views.
I tried to rewrite it but i was having trouble with the scaling and I cant import into studio 2 I only have the trial
I also tried making both the objects a parent of another object that i had the view follow but the view just follows one at a time.
Thanks fo this example! It really helps me out.
But, do you know of a way to limit as how far the view can travel beyond
specific x, y, w, h coordinates?
I’ve tried tampering around a bit, and I just could not find an answer to it myself.
I’m trying to figure that out too. Have you found a solution?
I’m actually testing a solution
Thanks so much for this example! Really helpful! One question: how would I go about adapting this to add a maximum view size? I want it to be able to zoom out to a maximum level at which point the player could leave the view. I just don’t want it to infinitely zoom out
You would need to add another line to view_dual after “vscale” setting to limit it, such as
vscale = min(vscale, 4)
This is a great piece of code. Thanks for the share!
I’m trying to use it to track an object starting at the top of the room and falling down to the ground with the other object being invisible and sitting still on the ground. I’m using the second object like an anchor so as to make the view start zoomed out (when the 1st object is at the top of the room) and as the object falls the view zooms in until it reaches the ground.
My question is this: Does anybody know how to make it so that the view doesn’t show outside the room at the top and bottom? So if the object would launch off the ground and head upward (away from the second object) the view zooms out so as to ‘track’ both objects (basically I want the view to stop zooming out if it is going to show outside of the room)
Aw man! I just realized “khaag” asked the question that I’m looking for the answer too. YellowAfterlife you answer said this:
You would need to add another line to view_dual after “vscale” setting to limit it, such as vscale = min(vscale, 4)
So is this what you mean:
vscale = max(1, abs(x2 – x1) / (vw – vb * 2), abs(y2 – y1) / (vh – vb * 2));
vscale = min(vscale, 4); (<– ADD THIS LINE HERE is what you are saying)
Hi, sorry for writing on an old article, but how would I go about following four objects at the same time?
Not that easily, so here’s a separate example for arbitrary number of followed objects: https://yal.cc/get/xm/visual/view-multi-follow.gmk
WOW, you’re the best! Thanks a lot!!
I tried the four object .gmk but it’s different from the two object .gmk. This one simply displays one object as all four. Anyway for four separate objects to be followed by one screen?
Well you could always assign all four separate objects to a parent, and have the screen follow the parent. I hope this helps.