Major tilemap/grid refactor, collision detection, interactable detection
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import "core:fmt"
|
||||
import "core:strings"
|
||||
import "vendor:raylib"
|
||||
|
||||
player: Player
|
||||
@@ -42,6 +43,7 @@ main :: proc() {
|
||||
|
||||
raylib.EndMode2D()
|
||||
raylib.DrawFPS(20, 20)
|
||||
draw_player_grid_debug()
|
||||
raylib.EndDrawing()
|
||||
|
||||
update(delta)
|
||||
@@ -62,3 +64,16 @@ draw :: proc() {
|
||||
draw_player(&player)
|
||||
}
|
||||
|
||||
draw_player_grid_debug :: proc() {
|
||||
gx, gy := player_pos_to_grid_pos()
|
||||
|
||||
tile := get_tile(&interactables_layer_grid, gx, gy)
|
||||
type := tile.type
|
||||
|
||||
s := fmt.tprintf("Player Grid Pos: (%d, %d) | Tile: %v", gx, gy, type)
|
||||
cs := strings.clone_to_cstring(s, context.temp_allocator)
|
||||
|
||||
|
||||
raylib.DrawText(cs, 20, 40, 20, raylib.GREEN)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user