Pygame Camera Tutorial: How to Make a Side-Scrolling Camera System

preview_player
Показать описание
In this tutorial, we'll be creating a camera side-scrolling camera system. We'll learn how scrolling works and how we can make our camera as flexible as possible.

All code/images can be found on my github:

Timestamps:
Intro to cameras in side-scrollers: 0:09
Creating the Camera Class : 0:58
Class Diagram: 2:08
Creating the Scroll Methods: 3:07
Following the Player (Follow): 3:41
Limiting the Camera View (Border): 5:14
Auto Scroll (Auto): 6:16
Putting it all together: 6:58
Showcasing the Camera System: 8:01

In the hopes of not wasting peoples time, I recorded this tutorial a little faster than normal, so feel free to watch it at 75% feed and pause as you need to :)

Music: Pokemon Gold/Silver - Pewter City

#pygame #gamedev #camera
Рекомендации по теме
Комментарии
Автор

Great Tutorial! I haven't watched this fully, but I'm sure it's great. It Seems very easy to understand. Good Job~

rolpon
Автор

Hi. I have an error saying: TypeError: object.__init__() takes exactly one argument (the instance to initialize)

kayes
Автор

thank you so much. For a very long time I couldn't find a way to implement camera . This video really helped me.

АртёмПетров-ччы
Автор

Great video! I was wondering if you could elaborate on hot to get the follow cam to lag behind the player a bit to try to make a smooth camera movement?

alastairm
Автор

Christian your videos are fantastic, you deserve and need more exposure to grow your following.

andreperras
Автор

theres is a problem with my code it says AttributeError: 'pygame.Surface' object has no attribute 'rect'

OneShotOneKill
Автор

Thank you so much for the tutorial, it is exactly what i needed for my project! <3

thunder
Автор

Hi could you do a similiar video, but for moving in any direction and the camera follows you. I think its referred to as "box camera"

shady
Автор

I like how you explain it concisely and clearly.... very helpfull tutorial

kelinci
Автор

Thank you very much. This is the only usefull camera tutorial that i have found on youtube

JkaBG
Автор

How do I work out what the values should be for my "self.left_border", "self.right_border" and "self.ground_y" variables?

Also, in the Github files for this, it references a "self.box" variable, but it doesn't seem to do anything in the code. What is it used for?

i_teleported_bread
Автор

Your Videos are always soo good! Please keep it up :D

subarunatsuki
Автор

I can't find the part where you define "player.ground_y", "player.left_border" or "player.right_border".

justcallmespike
Автор

can u make a video about syntax in pygame and all of pygames features and how to impliment them because all of the class stuff and camera functions are so confusing because of my lack of understanding about how such things work especially classes i only know the basics of classes and don't understand it very well

exetude
Автор

Thank you, your code helped for my game! I think you are good in the right now

bivashy
Автор

isn't that troubling that rectangles are in completly diffrent places than their surfaces? This approach looks a little odd to me.

dominiknowec
Автор

Hi, can you add a MIT license to your Github repository? I want to use your code as a reference for a part of the project which I will use for commercial purpose. I guess making the tutorial means you want me to learn from your code and make modifications to it to fit my needs. However, I still want to make sure; I don't want to deal with any legal issues. Thank you!!

embodythelogos
Автор

how do i check collision with other objects please ? the cats rect is now far of the rendering position.

brontosaurus
Автор

great tutorial, but i have an error that says that i dont have an object that called ground_y..
can you help me with that?

electrotal
Автор

can you explain the math in the const value?

blankbtw
join shbcf.ru