dknoma / RealPogGaming

RPG testing
1 stars 0 forks source link

Topdown platforming needs to be revisited. #2

Open dknoma opened 5 years ago

dknoma commented 5 years ago

As of now, topdown platforming physics is not working. Need to figure out the best way to detect height and depth differences with the player from the ground. Detecting differences between the player and other objects like enemies is more doable (as each enemy would have their own hitbox and everything, their height and depth can be calculated like the players).

The hard part is how to go about creating the actual terrain. At the current moment the terrain is part of a tilemap layer making it near impossible to detect depth as tilemaps are almost always not uniformly shaped. ex. the depth of one part of the tilemap could be different than the other.

One way may be to just make each part of the terrain its own uniform object and combine them to make the uneven terrains. This may be a little inefficient as many objects could be created.

Maybe need a way to figure out how to detect the player's current position from the ground below them. Whether it be the actual ground (h=0), or a platform underneath them (ex. h=4). This would also help determine if a player is currently above a platform or not (used in determining if a player is going to fall down, or land on top of a platform).

dknoma commented 5 years ago

Maybe we could keep a PlayerBase object with a collider at h=0 to keep track of the players ground position. NOTE: this height should never change. The collider can help determine if the player will fall to the ground (base is not inside a wall), or if will fall onto another platform (player height > platform height && base is inside a wall). If the player is lower than platform then player should not move forward. A shadow will be kept to determine which platform the player is currently above. Dont know how to go about this part yet.