Python Game Development: Scrolling Map Cameras

  Рет қаралды 4,929

HUCORP

HUCORP

Күн бұрын

Пікірлер
@_samuro_
@_samuro_ Жыл бұрын
Well done! Thank you for your lessons and efforts! I wish prosperity to your channel :D
@abdulrazaqAS
@abdulrazaqAS 5 ай бұрын
I have downloaded your repo, thanks for all the stuff. I have placed and animated the knife dude. He moves back and forth within a defined range and can throw knives when in range. I have also implemented the batarang attack. I also coded a sprite scraper file to help me get the parameters of sprites in a spritesheet file. I will fork the repo and upload my added stuffs.
@isuckatmc1728
@isuckatmc1728 7 ай бұрын
i dont understand, do you actually move eeach entity? but then you wouldnt need to move the player as well when walking, right? or do you just move the display position of your sprites but not their actual position? but then, how does collision detection still works? im so confused😅
@hucorp
@hucorp 7 ай бұрын
You're on the right track! I think that I could have explained this better in the video, but yes the player is moving while walking. Think of the camera as a rectangle that displays what is on the window. When the player moves right, we're moving this rectangle around it right as well. We have a map that is bigger than the window and we want the camera to cover all the pixels in the map. When every sprite is created they are assigned a (x, y) position on this map; we don't want to change the position of every tile in the map. Whatever's at (0, 0) on the map, should stay at (0, 0) on the map. The camera only affects what parts of the map are DRAWN on the screen. However, the camera's (0, 0) is going to be changing as we move right. As the camera moves right, we want the map to be DRAWN with an offset by the same amount that the player moved. So if the player started at (0,0) and moved 10 pixels to the right, their new position is going to be (10, 0). And whatever is on (10, 0) of the map is now going to be displayed as (0, 0) on the camera. Likewise, if we have an obstacle that is positioned at (20, 0) on the map, it's going to be drawn on the camera at (10,0) when the player moved 10 pixels to the right. It's like having two frames of reference: one is the map's pov which is the actual position and the other is the camera's. The map's (0, 0) is always defined and it's fixed, but the camera's (0,0) is shifted as the player moves.
@adenlahmar8822
@adenlahmar8822 6 ай бұрын
men i don't have any all_sprite
Cameras in Pygame
1:13:21
Clear Code
Рет қаралды 125 М.
Collisions in Pygame - Beginner Tutorial
10:59
Coding With Russ
Рет қаралды 56 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
2024 Pygame Projects | Showcase
2:51
Code King
Рет қаралды 498
Easy pathfinding in python [almost without math]
1:11:12
Clear Code
Рет қаралды 88 М.
3D mode | Geometry dash 2.2
12:06
Mulpan
Рет қаралды 13 М.
Netflix Removed React?
20:36
Theo - t3․gg
Рет қаралды 39 М.
Python Multithreading for Loading Animations
18:51
HUCORP
Рет қаралды 4,7 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН