proper positioning works now
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// src/render/player_positioning.cpp
|
||||
#include "player_positioning.h"
|
||||
#include "../background_dark_inverted.h"
|
||||
#include <cstdio>
|
||||
|
||||
// Convert a pivot coordinate (bottom-left) to the top-left draw position
|
||||
@@ -15,11 +16,9 @@ PlayerPosition get_aligned_frame_position(PlayerPosition base, int frame_index)
|
||||
else
|
||||
sprite_height = PLAYER_MASK_LINES_FRAME_3;
|
||||
|
||||
// The X coordinate stays the same (left edge aligned)
|
||||
// The Y coordinate moves upward by the sprite height,
|
||||
// because the pivot is bottom-left, but rendering starts from top-left
|
||||
PlayerPosition draw_pos;
|
||||
draw_pos.x = base.x;
|
||||
draw_pos.y = base.y - sprite_height + 1; // align to feet baseline
|
||||
draw_pos.y = (VIEW_HEIGHT - base.y) - sprite_height;
|
||||
|
||||
return draw_pos;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user