How to make a 2D Camera Pan & Zoom in Godot 4

  Рет қаралды 1,427

Real Robots

Real Robots

Күн бұрын

Next Video: Making an Item System: • How to make an Item Sy...
Previous Video: Pathfinding & Pawns: • How to make Rimworld i...
Patreon: / realrobots
In this particular video we'll give our camera the ability to pan and zoom.
Full Code: gitlab.com/realrobots/rimworl...
-----
In this series I'll show you how to make your own remix of Rimworld, or any similar top-down colony management/strategy game.
Puzzling out how to make a game you know is a great way to learn, we're obviously not going to make an exact copy, but we'll develop a lot of the features that make the game, and maybe even spin it off into something unique.
You can find the finished camera script here.
realrobots.net/files/youtube/...
00:00 Create CameraController.gd
01:30 Defining actions and key binds
03:14 Zoom
08:14 WASD Pan
14:33 Click and Drag Pan

Пікірлер: 20
@WorkshopWizard
@WorkshopWizard 20 күн бұрын
next video ideas: -Grid based object placement| -Terrain layers that dictate impassable movement (touched already in video 2) -Object generation within terrain generation for resources -UI -Animations for the world/objects/pawns Love these videos man, keep it going!!
@ShadyFoxShadify
@ShadyFoxShadify 17 күн бұрын
SO many yasss for the grid object placement tutorial, especially for isometric ones.
@mrussogamedev
@mrussogamedev 22 күн бұрын
YES for the edge detection for camera/mouse please! Really curious to see it handling a procedural generated like this one.
@signet2712
@signet2712 22 күн бұрын
Great tutorial series and explanations! Please keep it going!
@SoggyNoodle9
@SoggyNoodle9 21 күн бұрын
As some one involved with rimworld for a long time it's really fun to see a tutorial based on it, I'm glad you're taking the time to make the functions act the way you want them too and you explain it great while at it as well!
@sphynxcolt4030
@sphynxcolt4030 22 күн бұрын
Very nice tutotial! Camera movement & zoom is so important. Super cool that you did not just call it a day with the snappy zoom and panning, as maybe most would have, but even added camera smoothing. Really looking forward to what comes next :D
@definitelyturok
@definitelyturok 22 күн бұрын
Been looking for a series like this for godot for quite some time, thanks for doing this, much appreciated
@FatMiddleAgedMan
@FatMiddleAgedMan 22 күн бұрын
You have an excellent way of explaining things and fantastic pacing! Loving this series so far - keep up the amazing work! :D
@CoFloCipher
@CoFloCipher 22 күн бұрын
Happy to see another video. I’m loving this series so far! One small suggestion - try zooming in the view when writing code and when showing small ui elements. This can be done in post if you don’t remember to while filming. Again, awesome job so far and I can’t wait to see more!
@real_robots
@real_robots 22 күн бұрын
Thanks, I had the same comment on a previous video and then I completely forgot to do anything about it with this one. Next video is going to have big chunky text, I promise!
@omeed9015
@omeed9015 20 күн бұрын
Thanks so much for taking the time to post these!
@DJRTMC
@DJRTMC 13 күн бұрын
damn thats good material stuff
@brunch1572
@brunch1572 11 күн бұрын
Great video. I love the series. I made a couple modifications that I thought I'd share with anyone interested. The first is setting limits to zooming in and out. The second is making it so that in order to drag the camera, you must hold the drag toggle (space bar in my case) and then left click and drag. This functions like the Godot 2D editor and also like Aseprite. Zoom limits: 2 new variables and modified zoom_camera function var zoom_min: Vector2 = Vector2(0.1, 0.1) var zoom_max: Vector2 = Vector2(5.0, 5.0) func zoom_camera(delta): if Input.is_action_just_pressed("camera_zoom_in"): zoom_target *= 1.1 elif Input.is_action_just_pressed("camera_zoom_out"): zoom_target *= 0.9 zoom_target = clamp(zoom_target, zoom_min, zoom_max) #
@real_robots
@real_robots 11 күн бұрын
Zoom limits are a great idea, I can't believe I forgot to add those in
@DejaimeNeto
@DejaimeNeto 22 күн бұрын
yes
@JFLEEC
@JFLEEC 22 күн бұрын
nice !
@katherine2721
@katherine2721 22 күн бұрын
Sorry but is there a reason to put this in the process function instead of _input(event) function?
@real_robots
@real_robots 22 күн бұрын
Nope, not any good one. Only that I tend to prefer understanding my code a tick at a time and find events strange and confusing :-)
@katherine2721
@katherine2721 22 күн бұрын
@@real_robots That makes sense. I get a bit paranoid about multiple checks every tick (even though I doubt it's a real problem unless it's hundreds or thousands of nodes) so I try to put fewer things in process. But great series, keep going! Especially since I'm replaying Rimworld because of the anomaly update!
@jakes-dev1337
@jakes-dev1337 22 күн бұрын
The terrain generates multiple times on click, so thats perfectly reasonable​@@katherine2721
How to make an Item System in Godot 4
36:15
Real Robots
Рет қаралды 1 М.
How to make Rimworld in Godot 4: Pathfinding & Pawns
37:18
Real Robots
Рет қаралды 3,1 М.
Trágico final :(
01:00
Juan De Dios Pantoja
Рет қаралды 32 МЛН
Don't eat centipede 🪱😂
00:19
Nadir Sailov
Рет қаралды 23 МЛН
[Vowel]물고기는 물에서 살아야 해🐟🤣Fish have to live in the water #funny
00:53
How To Do Motion Capture in Blender for Free
2:11
RedLab Effects
Рет қаралды 216 М.
Further Understanding Of Composition in Godot 4
8:27
Geopopos - Gaming
Рет қаралды 328
How You Can Easily Make Your Code Simpler in Godot 4
6:59
Bitlytic
Рет қаралды 336 М.
I Built A Working 4D CINEMA In Minecraft!
11:06
Chippz
Рет қаралды 17 М.
Godot 4 Makes Multiplayer EASY!
5:42
Crigz Vs Game Dev
Рет қаралды 83 М.