Corrected player pos to be centered not top left
This commit is contained in:
+3
-3
@@ -15,7 +15,7 @@ Player :: struct {
|
|||||||
player_init :: proc(assets: ^Player_Assets) -> Player {
|
player_init :: proc(assets: ^Player_Assets) -> Player {
|
||||||
player := Player{}
|
player := Player{}
|
||||||
// center for now not really needed
|
// center for now not really needed
|
||||||
player.pos = {(WINDOW_WIDTH / 2), (WINDOW_HEIGHT / 2)}
|
player.pos = {(WINDOW_WIDTH / 2), (WINDOW_HEIGHT / 2)}
|
||||||
player.state = .IDLE
|
player.state = .IDLE
|
||||||
animation_play(&player.ani_state, &assets.clips[.IDLE])
|
animation_play(&player.ani_state, &assets.clips[.IDLE])
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ renderer_draw_player :: proc(player: ^Player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dst_rect := rl.Rectangle{
|
dst_rect := rl.Rectangle{
|
||||||
x = player.pos.x,
|
x = player.pos.x - f32(clip.frame_width) / 2,
|
||||||
y = player.pos.y,
|
y = player.pos.y - f32(clip.frame_height) / 2,
|
||||||
width = f32(clip.frame_width),
|
width = f32(clip.frame_width),
|
||||||
height = f32(clip.frame_height),
|
height = f32(clip.frame_height),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user