Smooth Camera Tutorial + Pan/Zoom [GameMaker Studio 2]

  Рет қаралды 27,231

GameMakerStation - Matharoo

GameMakerStation - Matharoo

Күн бұрын

Пікірлер: 107
@Baukereg
@Baukereg 5 жыл бұрын
This is how I like tutorial videos: quick and to the point. I was struggling with camera zooming but your video is very helpful. Cheers mate!
@paulomtts
@paulomtts 4 жыл бұрын
I can't stress enough how much I hate those long tutorials filled with babbling and useless comments.
@masterjohn3126
@masterjohn3126 Жыл бұрын
quick and to the point? theres only 2 lines of code anybody actually needs to know in the entire video yet its over 7 minutes
@misterr3083
@misterr3083 4 жыл бұрын
Such an incredible tutorial, so short but packed with an amazing amount of clear and useful information! You are so good at making tutorials. There is an art to clarity and simplicity and you have nailed it! Really really appreciate it.
@puntastic1351
@puntastic1351 3 ай бұрын
5 years it's been and this is still a solid tutorial , great job mate
@nyeponpon
@nyeponpon 3 жыл бұрын
I'm really impressed by how fast you go to the video's point. Usually, GMS tutorials in YT are made by someone who do not plan how to do the video in first place, there is no script and they get lost quickly or make useless long comments. Thanks a lot, keep it up!
@randokaratajev2617
@randokaratajev2617 Жыл бұрын
What if I told you I'm really impressed with the other comments that don't mock other creators while praising this channel? I understand you wanted to praise this creator but you could have done it in a more civil way. How can one be that ignorant to rant others who are educating you for free? It's not like they have millions of viewers/subs. Most peak at 100k max and that's pretty much nothing compared to todays youtube standards.
@nyeponpon
@nyeponpon Жыл бұрын
@@randokaratajev2617 you have a fair point, I should've thought better before commenting this. I apologize.
@leondecastro1807
@leondecastro1807 5 жыл бұрын
You know, I was having a bad day because I couldn't implement my camera properly until I saw this video. Good thing I subscribed to you back then, you are a god send sir GameMakerStation!
@edp5623
@edp5623 5 жыл бұрын
I've watched many videos on cameras for gms2, this one helped me the most.
@trex0n35
@trex0n35 3 жыл бұрын
I just gotta say, I love that your out here making quality content. This is such an upgrade to the camera I had before, I can't thank you enough :))
@CoffeeAI201
@CoffeeAI201 3 жыл бұрын
For anyone experiencing a jitter when the camera gets close to the target, replace “/“ with “div” when dividing by 2 This seems to be an issue with larger resolutions. I’ve noticed it in sprites with a lot of detail. Switching from “/“ to “div” cleans up the division and really smooths the camera out
@bradleypaquet7262
@bradleypaquet7262 2 жыл бұрын
Thanks so much for this
@Vizeff
@Vizeff 5 күн бұрын
This did so much for my game! Thanks a lot!
@AngelloMaggio
@AngelloMaggio Жыл бұрын
Love how direct your videos are, thank you so much for the help
@kevgmei
@kevgmei 4 жыл бұрын
Thanks, dude! Quick and to the point. Definitely putting you in the credits of my game for helping me out.
@TheAngryLibrarian
@TheAngryLibrarian 2 жыл бұрын
Thank you so much! This was the first tutorial I found that covered both following and zooming (and actually worked in my GM).
@bohdankulyk6672
@bohdankulyk6672 Жыл бұрын
You are so kind to share this valuable information! Thank you very much!
@ARamirez150
@ARamirez150 2 жыл бұрын
Finally, another GML tutorial creator who's really good at explaining things! (Shaun Spalding and Heartbeast being the other two)
@celesteorsa3918
@celesteorsa3918 Жыл бұрын
also FriendlyCosmonaut
@cjd0308
@cjd0308 3 жыл бұрын
Thank you so much for this tutorial. It was so helpful that I just signed up for your course!
@TinyGamesLab
@TinyGamesLab 5 жыл бұрын
Great content, as always! Keep it up Matharoo!
@GameMakerStation
@GameMakerStation 5 жыл бұрын
Thank you!
@likwid-official
@likwid-official 3 жыл бұрын
Thanks a ton for this tutorial! Very in-depth and helped me understand how all the of the code works!
@betatester03
@betatester03 4 жыл бұрын
Holy crap, man. This was a fantastic tutorial. I love your approach to presentation.
@GameMakerStation
@GameMakerStation 4 жыл бұрын
Thank you :)
@joezuru3753
@joezuru3753 3 ай бұрын
@@GameMakerStation is there a way to make the camera pan ahead rather than behind
@MacSacred
@MacSacred 4 жыл бұрын
Outstanding tutorial, thanks alot. I like the animations you did to frame the precise parts you're talking about, it allows the tutorial to be more dynamic and get straight to the point. It also helped structuring the code in my mind. I'm amazed at the quality of this video.
@wozatronics
@wozatronics 3 жыл бұрын
Greetings, thanks for the Tut, I'm only a lowly beginner at coding lol. But very easy to follow and re create. Thanks for your hard work. Its appreciated.
@nanashi3711
@nanashi3711 4 жыл бұрын
This is one of my favorite GameMaker tutorials! Great job! Note that zooming outside the size of the room will cause the camera to move in a way that the camera will cause the room to appear in the bottom right. One of the easiest ways to fix this is by commenting out the clamp functions and then the camera will center the room just fine.
@Fioravante_
@Fioravante_ 10 ай бұрын
THANK YOU MAN!
@vosovoso5220
@vosovoso5220 2 жыл бұрын
this is such a good tutorial!
@hector_dgz94
@hector_dgz94 5 жыл бұрын
your content is great, i wish you had more subs :D
@johnroberts8088
@johnroberts8088 5 жыл бұрын
Great tutorial, any chance on making one where you drag/pan/zoom like you would on google maps? So not follow a player but smooth click/drag/pan with just the mouse?
@GameMakerStation
@GameMakerStation 5 жыл бұрын
You can modify this one to only pan and zoom, and not follow the player. Should work perfectly.
@johnroberts8088
@johnroberts8088 5 жыл бұрын
@@GameMakerStation Great thanks!!!! Keep up the amazing work!
@johnroberts8088
@johnroberts8088 5 жыл бұрын
@@GameMakerStation Sorry one last question, do you think it is possible to pan and add easing one you let go of the mouse? You know what I mean? So you drag and pan then on release it still moves a bit easing down to stop. Thanks!!!
@GameMakerStation
@GameMakerStation 5 жыл бұрын
@@johnroberts8088 Yeah, you can store the camera's raw coordinates in your own variables, then interpolate (using lerp) the actual camera coordinates to them.
@johnroberts8088
@johnroberts8088 5 жыл бұрын
@@GameMakerStation Brilliant, thank you my friend, I will work on this. Congratulations on all your amazing content!
@wozatronics
@wozatronics 3 жыл бұрын
Fantastic Matharoo, well over my head, but awesome to use in my current project. Thanks for you time and effort in making these videos. Because of my lack of knowledge in using gamemaker, I cant get the camera to work across multiple rooms :-( Any help would be appreciated. I've attached a draw event to the camera, that draw a sprite for the background, it slowly rotates, it works on the great on the first room, but then it disappears on the 2nd room. Thanks. Paul.
@mrnobody7600
@mrnobody7600 Жыл бұрын
How can I make it so the camera won't exceed the room's width and height? I don't want the players to see the black parts.
@oakbyte4580
@oakbyte4580 3 жыл бұрын
Amazing work, thank you so much, helped me alot!
@Spoungebobsquarepan
@Spoungebobsquarepan Жыл бұрын
Thanks a lot!!🙌
@Damian_Stefann
@Damian_Stefann 5 жыл бұрын
I am not using gamemaker but these tutorials are perfect !!! i have some problems with differences but it´s perfect!
@GameMakerStation
@GameMakerStation 5 жыл бұрын
Great, what engine do you use?
@FoxyOfJungle
@FoxyOfJungle 4 жыл бұрын
Thank you so much! You helped me a lot! I spent all my day trying to do it but wasn't too good like this! I subscribed. :D
@RylanVG
@RylanVG 5 жыл бұрын
Good video. You are clear and concise.
@iMRDY99
@iMRDY99 3 жыл бұрын
Thank you so much for the tutorial..
@m77mdsd3
@m77mdsd3 4 жыл бұрын
can you make a 2 players camera tutorial and when the 2 players are near to each other the camera will be 1 and if they arenot they will be 2 cameras one for first player and one to the second
@chutney88
@chutney88 3 жыл бұрын
Hi. Can this method of panning and zooming be combined with the 2.5d parallax camera? Thanks.
@lilbigman5880
@lilbigman5880 4 жыл бұрын
Awesome tutorial!
@carlocgames2696
@carlocgames2696 3 жыл бұрын
Simply the best!!!
@isaac7253
@isaac7253 8 ай бұрын
Really great except that there's a weird little jitter when the player stops moving and the camera slows to a halt, tried using div instead of /, but that didn't fix my problem
@GuyHeroism
@GuyHeroism 4 жыл бұрын
so awesome man!
@thirdworldrider6991
@thirdworldrider6991 9 ай бұрын
hi my friends, love the camera, adapted it to my space 2d game. I am wondering which value would I have to manipulate to get a smooth zoom with the mouse wheel instead of like a stepping or increment zoom. Like if I shove the mouse wheel forward, it'll keep zooming until it reached the desired value then stop. I tried making a zoom factor based on the mouse wheel, but cannot get it to go that way. I basically want to add a max zoom out level and a max zoom in level. I dont think it can be done with the current code how the mouse wheel is used to zoom. A max cameX/Y position changes based on where the player is, so setting a max for that wont work.
@BrendonReimer
@BrendonReimer 7 ай бұрын
Instead of using a mouse zoom, I made it so clicking shift and alt would alter the variables zoomTargetW and zoomTargetH then did this in the step if (camW < zoomTargetW) && (camH < zoomTargetH) { addW = (zoomTargetW - camW) * 0.2; addH = (zoomTargetH - camH) * 0.2; camW += addW; camH += addH; // Position camX -= addW / 2; camY -= addH / 2; } if (camW > zoomTargetW) && (camH > zoomTargetH) { addW = (camW - zoomTargetW) * 0.2; addH = (camH - zoomTargetH) * 0.2; camW -= addW; camH -= addH; // Position camX += addW / 2; camY += addH / 2; }
@Mackievellian
@Mackievellian 2 ай бұрын
@@BrendonReimer You can further refine this too. Come hither for I have found the legend of this comment section. Thanks for sharing. :)
@AIO2011
@AIO2011 5 жыл бұрын
The tutorial is very good and helpful, but, in no point of the tutorial you explained that the created camera has to be deleted, specially when dealing with room changes. This could lead to some serious memory leaks. So anyone watching this tutorial, beware with that ;P
@GameMakerStation
@GameMakerStation 5 жыл бұрын
Good point!
@Riversofash
@Riversofash 4 жыл бұрын
So do we just add instance_destroy(); after all the code in end step? I’m not sure I’m understanding
@AIO2011
@AIO2011 4 жыл бұрын
@@Riversofash no, you could on the room change event add a camera destroy to avoid this memory leak
@KrepperestlerStudio
@KrepperestlerStudio 2 жыл бұрын
5:13 I did the exactly same thing. But game is subtracting _movex and _movey variables from camx and camy for each step. So camera position reaches to -ten thousands in a second.
@joezuru3753
@joezuru3753 4 ай бұрын
what if I want the camera to pan slightly AHEAD of the player rather than behind?
@randokaratajev2617
@randokaratajev2617 Жыл бұрын
tried it. Works fine but I think you forgot one of the key features about zoom in games: They are limited. Your code lets you zoom out more than the room size itself. How would one limit this to room_width or height ?
@lebedzecom
@lebedzecom 3 жыл бұрын
Круто! А будет ли это работать м Android games?
@nyeponpon
@nyeponpon 3 жыл бұрын
Oh, also, I have a question: is it possible to make a "perimeter" where the cam can move? I don't wanna players to move the camera outside the room- it gets a ugly visual bug when it happens.
@GameMakerStation
@GameMakerStation 3 жыл бұрын
Use clamp() as it is shown in this video.
@davidprestenberg5976
@davidprestenberg5976 2 жыл бұрын
how can I change what object the cameras following and keep the camera in the exact same position it was following the first object?
@davidprestenberg5976
@davidprestenberg5976 2 жыл бұрын
ooo i figured it out just storing cameras x and y in the destroy event so the new one has a starting point
@aerobetamax6022
@aerobetamax6022 4 жыл бұрын
Genius!
@JustBrian.
@JustBrian. Жыл бұрын
how to add a limit to zoom?
@thirdworldrider6991
@thirdworldrider6991 9 ай бұрын
need this!
@leniwolf
@leniwolf 2 жыл бұрын
not working for me, going insane. no idea what i'm doing wrong but when i import this code into my project, it's not working
@herom123
@herom123 4 жыл бұрын
Thankssss !!!!!!!
@powerpointdesigner7389
@powerpointdesigner7389 3 жыл бұрын
How to zoom in out using Pinch events for mobile platform
@MightyNO
@MightyNO Жыл бұрын
6:56 For a second I thought my monitor was falling xDD
@pedroantonio743
@pedroantonio743 5 жыл бұрын
This tutorial is very useful, you could do a tutorial on how to do a screen shake efect?
@GameMakerStation
@GameMakerStation 5 жыл бұрын
Sure, I'll add that to my list. :)
@GameMakerStation
@GameMakerStation 5 жыл бұрын
Thanks for the suggestion. I've made a screenshake tutorial and uploaded it.
@pedroantonio743
@pedroantonio743 5 жыл бұрын
@@GameMakerStation thank you very much !!!!, you have helped me a lot.
@NoahNCopeland
@NoahNCopeland 4 жыл бұрын
How would one tie this to a variable, like "Zoom," so that all you would have to do is increase or decrease Zoom and it will do the work...? In otherwise, how to divorce this from mousewheel
@NoahNCopeland
@NoahNCopeland 4 жыл бұрын
Figured it out. It's quite simple. Posting for others: all you need is this in step: camera_set_view_size(camera,CamW*Zoom,CamH*Zoom) just make sure that CamW and CamH are set in the create event and never touched again.
@stegeflott
@stegeflott 4 жыл бұрын
How do I put a max zoom and a min zoom treshold??? in this code.....
@KowBasher
@KowBasher 4 жыл бұрын
I second the question - I've been messing around with clamping the addW and addH values, but no luck so far.
@GameMakerStation
@GameMakerStation 4 жыл бұрын
@@KowBasher Hi! You can apply clamping to the camW/camH after adding the addW/addH to them. Example: camW = clamp(camW + addW, minimumWidth, maximumWidth); However, this won't affect the "camX -= addW / 2" part, which means that the camera will still be offset. To fix that, you can simply wrap the camera offset part inside a conditional block, which would check if the camW/H have changed at all (which means that you have to store the original camW/H before changing them, in separate variables, and then do a != comparison for the offset block). Hope this helps!
@KowBasher
@KowBasher 4 жыл бұрын
@@GameMakerStation Thanks! I had it almost working but your code smoothed out the camera zoom when it hit the min/max height. (it would twitch) I found that by clamping the max value by room_width and height did the trick for my game as the map is a single grid. Thank you so much for the reply and help! Great videos and editing!
@gnarsloggethesloth3085
@gnarsloggethesloth3085 3 жыл бұрын
@@GameMakerStation I'm having a problem with twitching when the camera hits the min/max zoom? This comment thread seems to address this but I'm not sure if I'm doing it right, because with the info here it still twitches
@mrnobody7600
@mrnobody7600 Жыл бұрын
@@KowBasher man can you share your code?
@ariessuggs3819
@ariessuggs3819 2 жыл бұрын
Anyone figure out how to restore original zoom level? is there a way to original level before changing it so I can make it go back? I is dum lol
@oldbomb
@oldbomb 3 жыл бұрын
Very nice tutorial as always, but I would like to add if you want to return to your starting resolution one time, it is better to use multiplying instead of adding for zooming, like this: //Zooming var factor = .1; var wheel = (1 +(factor *mouse_wheel_down()) ) /(1 +(factor *mouse_wheel_up()) ); if wheel != 1 and zoom *wheel > zoom_min and zoom *wheel < zoom_max{ zoom *= wheel; var corr_w = w *(1 -wheel) /2 var corr_h = h *(1 -wheel) /2 w = other.view_width /zoom; h = other.view_height /zoom; //correction position center x -= corr_w; y -= corr_h; }
@Boofener
@Boofener Жыл бұрын
where are you defining zoom? and view_width/view_height? im trying to add it to my dumb project but it just doesnt wanna work with what he has in the video
@robinrozo
@robinrozo 3 жыл бұрын
how i put limit to the zoom?
@GameMakerStation
@GameMakerStation 3 жыл бұрын
Use clamp()
@robinrozo
@robinrozo 3 жыл бұрын
@@GameMakerStation thank you
@rilysisumo9422
@rilysisumo9422 4 жыл бұрын
when i zoom in it stretches everything horizontally.
@GameMakerStation
@GameMakerStation 4 жыл бұрын
Hey, you can get help in our Discord server: discord.gg/TykHyqK
@arsray7285
@arsray7285 Жыл бұрын
What accent is this?
@dr.gadget9474
@dr.gadget9474 3 жыл бұрын
👍👍👍👍👍👍👍👍
@mattp8455
@mattp8455 4 жыл бұрын
Your avoid is super awkward! However, good job I learned a lot!!
@dr.gadget9474
@dr.gadget9474 3 жыл бұрын
СПАСИБО ЯНДЕКС ОЗВУЧКЕ ЧТО Я МОГУ СМОТРЕТЬ ЭТО НА РУССКОМ !!!!!
@officialshinky
@officialshinky 5 жыл бұрын
I liked the video, you put a lot of work in this i see! Don't let people hate on you because of your accent( just subscribe to pewdiepie and they'll love you )
@GameMakerStation
@GameMakerStation 5 жыл бұрын
Thanks! By now I'm used to people not liking my accent. I just try to do my best and to improve at the same time.
@joshc7154
@joshc7154 5 жыл бұрын
​@@GameMakerStation Your accent is great, and very rare. Like George Agdgdgwngo. Thanks for the tutorial!!
@romkupar5647
@romkupar5647 4 жыл бұрын
Omg,your accent is so weird)
Screen Shake Tutorial (GameMaker Studio 2)
2:04
GameMakerStation - Matharoo
Рет қаралды 10 М.
GMS2 Cameras: As Simple as Possible
13:27
PixelatedPope
Рет қаралды 66 М.
小丑家的感情危机!#小丑#天使#家庭
00:15
家庭搞笑日记
Рет қаралды 32 МЛН
How I Turned a Lolipop Into A New One 🤯🍭
00:19
Wian
Рет қаралды 11 МЛН
Fast GRASS Tutorial -- GameMaker Studio 2 (Vertex Buffers for Beginners)
12:54
GameMakerStation - Matharoo
Рет қаралды 31 М.
Organising Data | Menus: GMS2 [P1]
28:19
FriendlyCosmonaut
Рет қаралды 68 М.
How to Make a Good 2D Camera
11:38
Game Maker's Toolkit
Рет қаралды 410 М.
3 ways for the camera to follow the player | GMS2.3 Tutorial
18:32
Arend Peter Teaches
Рет қаралды 9 М.
From 2D to 2.5D: GameMaker Studio 2 TUTORIAL (Using 3D Camera) | Easy Parallax
8:27
GameMakerStation - Matharoo
Рет қаралды 31 М.
Click & drag Camera Pan - GMWolf
12:07
GM Wolf
Рет қаралды 7 М.
RESOLUTION guide for game devs & GameMaker
8:50
Sara Spalding
Рет қаралды 64 М.
Full Saving and Loading Tutorial in GMS2! (Part 1 of 2 - Room Saving)
28:08
Simple 2D Lighting - GameMaker Tutorial
24:57
DragoniteSpam
Рет қаралды 7 М.
Buttons GUI  |   GameMaker Studio 2   [ UI Series: Part 1 ]
8:58
GameMakerStation - Matharoo
Рет қаралды 43 М.