Example rendering

This commit is contained in:
2025-10-08 22:34:27 -05:00
parent 20cf016b06
commit fef31b9102
9 changed files with 133 additions and 10 deletions

View File

@@ -45,4 +45,19 @@ void entityUpdate(entity_t *entity) {
assertNotNull(entity, "Entity pointer cannot be NULL");
assertTrue(entity->type < ENTITY_TYPE_COUNT, "Invalid entity type");
assertTrue(entity->type != ENTITY_TYPE_NULL, "Cannot have NULL entity type");
// Velocity
for(uint8_t i = 0; i < WORLD_DIMENSIONS; i++) {
if(entity->velocity[i] == 0) continue;
worldChunkPosAdd(&entity->position[i], entity->velocity[i]);
if(entity->velocity[i] < 0) {
entity->velocity[i] += ENTITY_FRICTION;
if(entity->velocity[i] >= -ENTITY_MIN_VELOCITY) entity->velocity[i] = 0;
} else {
entity->velocity[i] -= ENTITY_FRICTION;
if(entity->velocity[i] <= ENTITY_MIN_VELOCITY) entity->velocity[i] = 0;
}
}
}