Merge branch 'main' of yibble.dev:bulmanator/ld58

This commit is contained in:
2025-10-06 17:55:32 +01:00
8 changed files with 92 additions and 13 deletions

View File

@@ -48,8 +48,13 @@ void PlayerInit(G_State *game, Player *player) {
World *world = game->world;
player->world = world;
world->player.bulletsLoaded = PLAYER_BULLET_COUNT;
world->player.currentArea = WORLD_AREA_OUTSIDE;
player->bulletsLoaded = PLAYER_BULLET_COUNT;
player->currentArea = WORLD_AREA_OUTSIDE;
player->health = 3;
player->collision.size.x = 1;
player->collision.size.x = 2;
G_Outfit *outfit = &player->outfit;
@@ -122,6 +127,10 @@ void PlayerInput(SDL_Event *event, Player *player)
void PlayerUpdate(F32 delta, Player *player) {
player->controls.shot = false;
V2f dir = V2F(0, 0);
if(player->health == 0){
printf("dead :(");
player->health = 3;
}
if(player->controls.upDown) {
dir.y -= 1;
player->outfit.dir = G_OUTFIT_DIR_BACK;
@@ -154,8 +163,8 @@ void PlayerUpdate(F32 delta, Player *player) {
}
}
dir = V2f_Scale(NormaliseV2F(dir), PLAYER_SPEED*delta);
player->pos.x += dir.x;
player->pos.y += dir.y;
player->collision.pos.x += dir.x;
player->collision.pos.y += dir.y;
}
void PlayerDraw(D_Context *draw, Player *player) {
@@ -170,7 +179,7 @@ void PlayerDraw(D_Context *draw, Player *player) {
U32 tid = outfit->e[dir].e[it];
if (tid != 0) {
U32 flags = D_RECT_UV_ASPECT | (flipped ? D_RECT_FLIP_X : 0);
D_Rect(draw, player->pos.x, player->pos.y, .texture = tid, .uv = pframe, .flags = flags);
D_Rect(draw, player->collision.pos.x, player->collision.pos.y, .texture = tid, .uv = pframe, .flags = flags);
}
}
}