Compare commits

..

9 Commits

Author SHA1 Message Date
En Yi 0a4c700bf6 Add camera lookahead when falling 2023-10-08 12:34:35 +08:00
En Yi ae730ce029 Finish initial camera behaviour
x follows a mass-spring-damper system
y is simple lerp. Doesnt follow player when jumping
2023-10-08 12:13:03 +08:00
En Yi b56e0e7f10 Clamp target position and revert to old behaviour
Need to figure out the y direction update. Should not be
the same way as x
2023-10-08 12:13:03 +08:00
En Yi d1d8033b77 Only apply new behaviour to x direction only 2023-10-08 12:13:03 +08:00
En Yi f8eab8acec Adjust parameters for camera 2023-10-08 12:13:03 +08:00
En Yi 835b88f1f4 Fix coyote jump issue
Changelog:
- Add check for coyote timer when jumping
- Set ladder state AFTER the jump check
2023-10-08 12:13:03 +08:00
En Yi 064341e2eb Initial implementation of camera system
Changelog:
- Implement effectively a PI controller
2023-10-08 12:13:03 +08:00
En Yi 533e2998bc Include missing headers in rres packer 2023-10-08 12:07:17 +08:00
En Yi de29201a41 Fix uninitialised overlap value 2023-10-08 12:07:04 +08:00
3 changed files with 5 additions and 1 deletions

View File

@ -3,7 +3,10 @@
#define RRES_IMPLEMENTATION
#include "rres.h" // Required to read rres data chunks
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
// Load a continuous data buffer from rresResourceChunkData struct
static unsigned char *LoadDataBuffer(rresResourceChunkData data, unsigned int rawSize)

View File

@ -23,7 +23,7 @@ uint8_t find_AABB_overlap(const Vector2 tl1, const Vector2 sz1, const Vector2 tl
// Note that we include one extra pixel for checking
// This avoid overlapping on the border
Vector2 l1, l2;
Vector2 tmp;
Vector2 tmp = {0,0};
uint8_t overlap_x, overlap_y;
l1.x = tl1.x;
l1.y = tl1.x + sz1.x;

View File

@ -1821,6 +1821,7 @@ void camera_update_system(Scene_t* scene)
if (p_ctransform->position.y >= data->camera.base_y)
{
data->camera.target_pos.y = p_ctransform->position.y;
data->camera.target_pos.y += p_ctransform->velocity.y * 0.2;
}
}
data->camera.target_pos.x = Clamp(data->camera.target_pos.x, data->game_rec.width / 2,