Entities - SC-SGS/surviving-sarntal GitHub Wiki
So far, we only discussed convex polygons. The algorithms as described above can be applied to rocks without restriction. The hiker behaves very similarly but with some key differences. The hiker movement is governed by the user input. Gravity is only applied when the hiker is in the air. For collisions, the hiker hitbox is a convex polygon that does not rotate. When a rock hits the hiker, the rock is destroyed and damage is applied to the hiker. Moreover, a knockback impulse based on the rock's impulse is applied to the hiker.
Terrain collisions are also different.
In air, the hiker bounces off the terrain like a rock would.
On the ground however, the hiker needs to be able to walk smoothly without colliding with the terrain.
This is achieved by clamping the hiker on the terrain with a small upward displacement
The most simple entity is the monster or kill bar. Its movement is only characterized by an x coordinate. $$ x_{\text{monster}}^{t+1} = x_{\text{monster}}^{t} + \delta t \cdot v_{\text{monster}}^{t} $$ The texture is always placed on top of the terrain. With the velocity of the monster increasing over time, difficulty is raised. There are no collisions with the monster.