Tile Map Collisions | MonoGame Tutorial Ep. 12
ฝัง
- เผยแพร่เมื่อ 2 ธ.ค. 2024
- Thanks for watching!
Yes I covered collisions in a previous video, but this is something different! Tile maps do not need the same level of precision when it comes to 2D AABB collision. This method covered in the video shows a "blazingly fast" and pretty robust way of handling tile map collisions. I hope you enjoy!
MonoGame Website:
monogame.net
Join my Discord:
/ discord
Support me on Patreon:
/ codingwithsphere
Source Code:
github.com/m1c...
I figured out to solve both at the same time today trying to do by myself. I could make it work. your videos are helping me a lot. I put to check the vertical while applying gravity and the horizontal while walking.
This collision method is great, but it breaks when the player size isn't perfectly divisible by the tile size. In some cases, it's not noticeable, but I found that, using your tile size of 64, if I set the player size any multiple of tiles + 6 pixels (70 or 134 for example), you start to get noticeable shaking when colliding with walls to the right or bottom, and if you set player size to anything less than 1 tile, the entire sprite can enter a wall to the right or bottom before the collision is detected and the sprite is abruptly thrown out of the wall.
Basically, it works great as long as your sprite's dimensions are at least one tile large and no more than 5 pixels larger than the largest area you can construct within it with full tiles.
this was really helpful was stuck on why this was happening for hours lmao
Great tutorial! Keep em up! :D
yooo new sphere upload
Great tutorial!
Are you planning to make a video about gravity, jumps and stuff?
que buen tutorial 👍👍
Collision handling is soo annoying. I spent a whole weak tweaking it, and i still don't like how movement feels in my game. Plus sometimes i just clip into a wall for no reason. It's actually depressing
I always have a hard time getting collisions working straight away. I like to keep a generic reference implementation to help with the headache. definitely one of the harder parts of making a game
@xmlstudios i just added like a movement collision aura. If there is a rectangle in there it starts checking it N times per frame, where N is the length of character's direction vector
Checking for collisions with the main hitbox
Where is the python???🫠😫
The next series will most likely use python !