diff --git a/assets/impact-sounds/footstep_snow_003.ogg b/assets/impact-sounds/footstep_snow_003.ogg new file mode 100644 index 0000000..70447bf Binary files /dev/null and b/assets/impact-sounds/footstep_snow_003.ogg differ diff --git a/assets/impact-sounds/footstep_wood_003.ogg b/assets/impact-sounds/footstep_wood_003.ogg new file mode 100644 index 0000000..7883eaa Binary files /dev/null and b/assets/impact-sounds/footstep_wood_003.ogg differ diff --git a/assets/impact-sounds/impactPunch_heavy_002.ogg b/assets/impact-sounds/impactPunch_heavy_002.ogg new file mode 100644 index 0000000..8573e89 Binary files /dev/null and b/assets/impact-sounds/impactPunch_heavy_002.ogg differ diff --git a/assets/kenney-ui/PNG/Red/Default/button_square_depth_flat.png b/assets/kenney-ui/PNG/Red/Default/button_square_depth_flat.png new file mode 100644 index 0000000..6324c37 Binary files /dev/null and b/assets/kenney-ui/PNG/Red/Default/button_square_depth_flat.png differ diff --git a/assets/kenney-ui/PNG/Red/Default/button_square_flat.png b/assets/kenney-ui/PNG/Red/Default/button_square_flat.png new file mode 100644 index 0000000..1405f54 Binary files /dev/null and b/assets/kenney-ui/PNG/Red/Default/button_square_flat.png differ diff --git a/assets/kenney-ui/PNG/Red/Double/button_square_depth_flat.png b/assets/kenney-ui/PNG/Red/Double/button_square_depth_flat.png new file mode 100644 index 0000000..c4bd5cf Binary files /dev/null and b/assets/kenney-ui/PNG/Red/Double/button_square_depth_flat.png differ diff --git a/assets/kenney-ui/PNG/Red/Double/button_square_flat.png b/assets/kenney-ui/PNG/Red/Double/button_square_flat.png new file mode 100644 index 0000000..b7a2d19 Binary files /dev/null and b/assets/kenney-ui/PNG/Red/Double/button_square_flat.png differ diff --git a/assets/kenney-ui/Sounds/tap-b.ogg b/assets/kenney-ui/Sounds/tap-b.ogg new file mode 100644 index 0000000..95fcebf Binary files /dev/null and b/assets/kenney-ui/Sounds/tap-b.ogg differ diff --git a/assets/tiled/map.tmx b/assets/tiled/map.tmx index 60ed328..de82d90 100644 --- a/assets/tiled/map.tmx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0,0, +90,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +90,91,91,91,0,0,0,0,0,0,0,0,0,0,0,0 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -20,6 +56,96 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,91,91,91,91,91,91,91,91,91,0,0,0,0 + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,91,91,91,91,91,91,91,91,0,0,0,0,0,0,0, +0,91,90,90,90,90,90,90,91,0,0,0,0,0,0,0, +0,91,90,90,90,90,90,90,91,0,0,0,0,0,0,0, +0,91,90,90,90,90,90,90,91,0,0,0,0,0,0,0, +0,91,90,90,90,90,90,90,91,0,0,0,0,0,0,0, +0,91,90,90,90,90,90,90,91,0,0,0,0,0,0,0, +0,91,91,91,91,91,91,91,91,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,91,91,91,91,91,91,91,91,0,0,0,0,0,0,0, +0,91,90,90,90,90,90,90,91,0,0,0,0,91,91,91, +0,91,90,90,90,90,90,90,91,0,0,0,0,91,90,90 + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,91,91,91,91,91,91,0,0,0,0,91,91,91,91,91, +0,91,90,90,90,90,91,0,0,0,0,91,90,90,90,90, +0,91,90,90,90,90,91,91,91,91,91,91,90,90,90,90, +0,91,90,90,90,90,90,90,90,90,90,90,90,90,90,90 + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,91,90,90,90,90,90,90,90,91,0,0,0,0, @@ -38,6 +164,168 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + +0,91,90,90,90,90,90,90,91,0,0,0,0,91,90,90, +0,91,90,90,90,90,90,90,91,0,0,0,0,91,90,90, +0,91,90,90,90,90,90,90,91,0,0,0,0,91,91,91, +0,91,91,91,91,91,91,91,91,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,91,91,91,91, +0,91,91,91,91,91,91,91,91,0,0,0,91,90,90,90, +0,91,90,90,90,90,90,90,91,0,0,0,91,90,90,90, +0,91,90,90,90,90,90,90,91,0,0,0,91,90,90,90, +0,91,90,90,90,90,90,90,91,0,0,0,91,90,90,90, +0,91,90,90,90,90,90,90,91,0,0,0,91,90,90,90, +0,91,90,90,90,90,90,90,91,0,0,0,91,91,91,91, +0,91,91,91,91,91,91,91,91,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,91,91,91,91,91, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90 + + +90,90,90,90,90,91,0,0,0,0,0,0,0,0,0,0, +90,90,90,90,90,91,0,0,0,0,0,0,0,0,0,0, +91,91,91,91,91,91,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,91,91,0,0,0,0,0,0,0,0,0,0,0,0,0, +90,90,91,91,91,91,91,0,0,0,0,0,0,0,0,0, +90,90,91,90,90,90,91,0,0,0,0,0,0,0,0,0, +90,90,90,90,90,90,91,0,0,0,0,0,0,0,0,0, +90,90,91,90,90,90,91,0,0,0,0,0,0,0,0,0, +90,90,91,91,91,91,91,0,0,0,0,0,0,0,0,0, +91,91,91,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,91,91,91,0,0,0,0,0,0,0,0,0,0,0,0, +90,90,90,91,91,91,91,91,0,0,0,0,0,0,0,0, +90,90,90,91,90,90,90,91,0,0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0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,91,91,91,91, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,91,91,91,91,91, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,0,91,91,91,91,91, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + +90,90,90,90,90,90,90,91,0,0,0,0,0,0,0,0, +90,90,90,91,90,90,90,91,0,0,0,0,0,0,0,0, +90,90,90,91,91,91,91,91,0,0,0,0,0,0,0,0, +91,91,91,91,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,91,91,91,0,0,0,0,0,0,0,0,0,0,0,0, +90,90,90,91,91,91,91,91,0,0,0,0,0,0,0,0, +90,90,90,91,90,90,90,91,0,0,0,0,0,0,0,0, +90,90,90,90,90,90,90,91,0,0,0,0,0,0,0,0, +90,90,90,91,90,90,90,91,0,0,0,0,0,0,0,0, +90,90,90,91,91,91,91,91,0,0,0,0,0,0,0,0, +91,91,91,91,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + +0,0,0,0,0,91,91,91,91,91,91,91,91,91,0,0, +0,0,0,0,0,91,90,90,90,90,90,90,90,91,91,91, +0,0,0,0,0,91,90,90,90,90,90,90,90,91,90,90, +0,0,0,0,0,91,90,90,90,90,90,90,90,90,90,90, +0,0,0,0,0,91,90,90,90,90,90,90,90,91,90,90, +0,0,0,0,0,91,91,91,90,90,90,90,90,91,91,91, +0,0,0,0,0,0,0,91,91,91,91,91,91,91,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,91,91,91,91,91,91,91,91,91,0,0,0, +0,0,0,0,91,90,90,90,90,90,90,90,91,0,0,0, +0,0,0,0,91,90,90,90,90,90,90,90,91,0,0,0, +0,0,0,0,91,90,90,90,90,90,90,90,91,0,0,0, +0,0,0,0,91,90,90,90,90,90,90,90,91,0,0,0, +0,0,0,0,91,91,91,90,90,90,91,91,91,0,0,0, +0,0,0,0,0,0,91,91,91,91,91,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +91,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +90,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +90,91,0,0,0,0,0,0,0,0,0,0,91,91,91,91, +90,91,0,0,0,0,0,0,0,0,91,91,91,90,90,90, +91,91,0,0,0,0,0,0,0,0,91,90,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,91,90,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,91,90,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,91,90,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,91,90,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,91,90,90,90,90,90, +0,0,0,0,0,0,0,0,0,0,91,90,91,91,90,90, +0,0,0,0,0,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,0,0,98,0,0,0,0, -0,98,0,7,0,0,98,98,98,98,98,98,0,0,40,0, -0,98,0,7,72,0,0,0,0,0,0,0,0,0,40,0 +0,99,99,99,99,99,99,0,0,0,0,99,99,99,99,99, +0,86,0,0,0,0,86,0,0,0,0,86,0,0,0,0, +0,86,0,7,0,0,86,86,86,86,86,86,0,0,40,0, +0,86,0,7,72,0,0,0,0,0,0,0,0,0,40,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -182,10 +470,10 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,86,72,0,0,7,0,0,40,86,0,0,0,0, @@ -206,40 +494,40 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,86,72,0,0,0,0,0,86,0,0,0,0,98,72,0, -0,86,0,0,0,8,0,40,86,0,0,0,0,98,0,0, -0,86,0,0,0,0,0,0,86,0,0,0,0,98,98,98, +0,86,72,0,0,0,0,0,86,0,0,0,0,86,72,0, +0,86,0,0,0,8,0,40,86,0,0,0,0,86,0,0, +0,86,0,0,0,0,0,0,86,0,0,0,0,86,86,86, 0,86,86,86,86,86,86,86,86,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,98,98,98,98, -0,99,99,99,99,99,99,99,99,0,0,0,98,0,0,0, -0,86,0,0,0,0,0,0,86,0,0,0,98,0,0,0, -0,86,0,0,0,7,0,40,86,0,0,0,98,0,72,0, -0,86,72,0,0,0,0,0,86,0,0,0,98,0,0,0, -0,86,0,0,0,8,0,41,86,0,0,0,98,0,0,0, -0,86,0,0,0,0,0,0,86,0,0,0,98,98,98,98, +0,0,0,0,0,0,0,0,0,0,0,0,99,99,99,99, +0,99,99,99,99,99,99,99,99,0,0,0,86,0,0,0, +0,86,0,0,0,0,0,0,86,0,0,0,86,0,0,0, +0,86,0,0,0,7,0,40,86,0,0,0,86,0,72,0, +0,86,72,0,0,0,0,0,86,0,0,0,86,0,0,0, +0,86,0,0,0,8,0,41,86,0,0,0,86,0,0,0, +0,86,0,0,0,0,0,0,86,0,0,0,86,86,86,86, 0,86,86,86,86,86,86,86,86,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,98,98,98,98,98, -0,0,0,0,0,0,0,0,0,0,0,98,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,98,0,0,0,0 +0,0,0,0,0,0,0,0,0,0,0,99,99,99,99,99, +0,0,0,0,0,0,0,0,0,0,0,86,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,86,0,0,0,0 -0,0,7,7,40,98,0,0,0,0,0,0,0,98,0,0, -0,0,0,0,0,98,0,0,0,0,0,0,0,98,0,0, -98,98,98,98,98,98,0,0,0,0,0,0,0,98,98,98, +0,0,7,7,40,86,0,0,0,0,0,0,0,98,0,0, +0,0,0,0,0,86,0,0,0,0,0,0,0,98,0,0, +86,86,86,86,86,86,0,0,0,0,0,0,0,98,98,98, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -98,98,98,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,98,98,98,98,98,0,0,0,0,0,0,0,0,0, -7,0,98,0,0,0,98,0,0,0,0,0,0,0,0,0, -0,0,12,0,40,0,98,0,0,0,0,0,0,0,0,0, -7,0,98,0,0,0,98,0,0,0,0,0,0,0,0,0, -0,0,98,98,98,98,98,0,0,0,0,0,0,0,0,0, -98,98,98,0,0,0,0,0,0,0,0,0,0,0,0,0, +99,99,99,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,86,99,99,99,99,0,0,0,0,0,0,0,0,0, +7,0,86,0,0,0,86,0,0,0,0,0,0,0,0,0, +0,0,12,0,40,0,86,0,0,0,0,0,0,0,0,0, +7,0,86,0,0,0,86,0,0,0,0,0,0,0,0,0, +0,0,86,86,86,86,86,0,0,0,0,0,0,0,0,0, +86,86,86,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -98,98,98,98,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,98,98,98,98,98,0,0,0,0,0,0,0,0, -0,0,0,98,0,0,0,98,0,0,0,0,0,0,0,0 +99,99,99,99,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,86,99,99,99,99,0,0,0,0,0,0,0,0, +0,0,0,86,0,0,0,86,0,0,0,0,0,0,0,0 0,72,0,7,7,0,40,98,0,0,0,0,0,0,0,0, @@ -260,9 +548,9 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,98,0,7,0,0,98,98,98,98,98,98,0,0,40,0, -0,98,0,0,0,0,98,0,0,0,0,98,0,0,0,0, -0,98,98,98,98,98,98,0,0,0,0,98,98,98,98,98, +0,86,0,7,0,0,86,86,86,86,86,86,0,0,40,0, +0,86,0,0,0,0,86,0,0,0,0,86,0,0,0,0, +0,86,86,86,86,86,86,0,0,0,0,86,86,86,86,86, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -278,9 +566,9 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -98,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,86,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,86,86,86,86,86, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,8,0,25,0,40,0,98,0,0,0,0,0,0,0,0, -0,0,0,98,0,0,0,98,0,0,0,0,0,0,0,0, -0,0,0,98,98,98,98,98,0,0,0,0,0,0,0,0, -98,98,98,98,0,0,0,0,0,0,0,0,0,0,0,0, +0,8,0,25,0,40,0,86,0,0,0,0,0,0,0,0, +0,0,0,86,0,0,0,86,0,0,0,0,0,0,0,0, +0,0,0,86,86,86,86,86,0,0,0,0,0,0,0,0, +86,86,86,86,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -98,98,98,98,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,98,98,98,98,98,0,0,0,0,0,0,0,0, -0,0,0,98,0,0,0,98,0,0,0,0,0,0,0,0, -0,8,0,12,0,42,0,98,0,0,0,0,0,0,0,0, -0,0,0,98,0,0,0,98,0,0,0,0,0,0,0,0, -0,0,0,98,98,98,98,98,0,0,0,0,0,0,0,0, -98,98,98,98,0,0,0,0,0,0,0,0,0,0,0,0, +99,99,99,99,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,86,99,99,99,99,0,0,0,0,0,0,0,0, +0,0,0,86,0,0,0,86,0,0,0,0,0,0,0,0, +0,8,0,12,0,42,0,86,0,0,0,0,0,0,0,0, +0,0,0,86,0,0,0,86,0,0,0,0,0,0,0,0, +0,0,0,86,86,86,86,86,0,0,0,0,0,0,0,0, +86,86,86,86,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -0,0,0,0,0,86,86,86,86,86,86,86,86,86,0,0, -0,0,0,0,0,86,0,0,0,0,0,0,0,86,86,86, +0,0,0,0,0,99,99,99,99,99,99,99,99,99,0,0, +0,0,0,0,0,86,0,0,0,0,0,0,0,86,99,99, 0,0,0,0,0,86,0,0,0,0,0,7,0,86,0,0, 0,0,0,0,0,86,0,0,0,72,0,0,0,38,0,41, 0,0,0,0,0,86,25,8,0,0,0,7,0,86,0,0, @@ -369,10 +657,10 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -86,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +99,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,86,0,0,0,0,0,0,0,0,0,0,86,86,86,86, -0,86,0,0,0,0,0,0,0,0,86,86,86,0,0,0, +0,86,0,0,0,0,0,0,0,0,0,0,99,99,99,99, +0,86,0,0,0,0,0,0,0,0,99,99,86,0,0,0, 86,86,0,0,0,0,0,0,0,0,86,51,8,0,0,0, 0,0,0,0,0,0,0,0,0,0,86,51,8,0,0,0, 0,0,0,0,0,0,0,0,0,0,86,0,0,0,72,0, @@ -389,8 +677,8 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -86,86,86,0,0,0,0,0,0,0,0,0,0,0,0,0, +99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +86,99,99,0,0,0,0,0,0,0,0,0,0,0,0,0, 9,25,86,0,0,0,0,0,0,0,0,0,0,0,0,0, 9,25,86,0,0,0,0,0,0,0,0,0,0,0,0,0, 9,25,86,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -405,7 +693,7 @@ - + @@ -421,19 +709,54 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.zig b/build.zig index cbfdc76..dc77d54 100644 --- a/build.zig +++ b/build.zig @@ -149,6 +149,8 @@ fn buildProject(ctx: Context, target: Build.ResolvedTarget, optimize: std.builti "tiled/map.tmx", "tiled/tileset.tsx", "impact-sounds/footstep_concrete_000.ogg", + "impact-sounds/footstep_wood_003.ogg", + "impact-sounds/impactPunch_heavy_002.ogg", "kenney-ui/PNG/Red/Double/button_square_depth_flat.png", "kenney-ui/PNG/Red/Default/button_square_depth_flat.png", "kenney-ui/PNG/Red/Double/button_square_flat.png", @@ -278,8 +280,9 @@ fn buildProject(ctx: Context, target: Build.ResolvedTarget, optimize: std.builti // needs to be linked in a separate build step with the Emscripten linker const main_lib = b.addLibrary(.{ .name = "index", - .root_module = exe_mod + .root_module = exe_mod, }); + exe_mod.link_libc = true; const dep_emsdk = dep_sokol.builder.dependency("emsdk", .{}); diff --git a/build.zig.zon b/build.zig.zon index ea4e36b..c5b4e45 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -8,8 +8,8 @@ .hash = "sokol-0.1.0-pb1HK0kUQABqwuelY7BmmQmAm-jLBZKJ7uyoxkdS49Ib", }, .cimgui = .{ - .url = "git+https://github.com/floooh/dcimgui.git#ef68bcf1ea0a8218f4a2f24fb9414515ecbf5af4", - .hash = "cimgui-0.1.0-44ClkVBEnABUEg0-NuUgCcvqhRLr9BCUWHFbuVYt9Nuv", + .url = "git+https://github.com/floooh/dcimgui.git#461f457600a70a19001c735a513a2bec4c7caae7", + .hash = "cimgui-0.1.0-44ClkVBEnAA-LAAR9o0cUrN7CsKHR5hsMj-Byh7sFJLK", .lazy = true }, .stb = .{ diff --git a/src/app.zig b/src/app.zig index bc50b63..568e7e7 100644 --- a/src/app.zig +++ b/src/app.zig @@ -77,6 +77,20 @@ const Point = struct { pub fn eql(lhs: Point, rhs: Point) bool { return lhs.x == rhs.x and lhs.y == rhs.y; } + + pub fn toDirection(self: Point) ?Direction { + if (self.x < 0) { + return .left; + } else if (self.x > 0) { + return .right; + } else if (self.y > 0) { + return .down; + } else if (self.y < 0) { + return .up; + } else { + return null; + } + } }; const Entity = struct { @@ -84,6 +98,7 @@ const Entity = struct { visual_pos: Vec2 = .init(0, 0), visual_layer: Layer, + sprite: ?Gfx.Sprite.Id = null, player_direction: Direction = .down, player_frame_index: u32 = 0, @@ -255,6 +270,7 @@ const World = struct { const TickContext = struct { world: *World, undo_frame: UndoFrame = .empty, + box_fell: bool = false, fn moveEntity(self: *TickContext, id: Entity.Id, dir: Point) bool { if (dir.x == 0 and dir.y == 0) { @@ -275,6 +291,7 @@ const TickContext = struct { if (other.type == .box_hole) { if (!self.world.hasBoxInHole(other_id)) { if (this.type == .box and box_hole_id == Entity.Id.nil) { + self.box_fell = true; box_hole_id = other_id; } else { return false; @@ -304,15 +321,7 @@ const TickContext = struct { } if (this.type == .player) { - if (dir.x < 0) { - this.player_direction = .left; - } else if (dir.x > 0) { - this.player_direction = .right; - } else if (dir.y > 0) { - this.player_direction = .down; - } else if (dir.y < 0) { - this.player_direction = .up; - } + this.player_direction = dir.toDirection().?; } this.pos = next_pos; @@ -352,7 +361,8 @@ button_down_sprite: Gfx.Sprite.Id, box_sprites_by_color: std.EnumArray(BoxColor, BoxSprites), footstep_buffer: Audio.BufferId, -footstep_sound: Audio.SoundId = .nil, +hit_wall_buffer: Audio.BufferId, +box_fall_buffer: Audio.BufferId, sfx_bus: Audio.BusId, ui_bus: Audio.BusId, @@ -480,6 +490,12 @@ pub fn init(self: *App, plt: Platform.Init) !?u8 { .vorbis = plt.assets.readFile("kenney-ui/Sounds/tap-b.ogg") }) }), + .hit_wall_buffer = Audio.addBuffer(.{ + .vorbis = plt.assets.readFile("impact-sounds/footstep_wood_003.ogg") + }), + .box_fall_buffer = Audio.addBuffer(.{ + .vorbis = plt.assets.readFile("impact-sounds/impactPunch_heavy_002.ogg") + }), .level_order = &.{}, .world = undefined, @@ -813,12 +829,18 @@ pub fn frame(self: *App, plt: *Platform.Frame) !void { interpolate_pos = true; const prev_player_direction = entity.player_direction; - if (tick_context.moveEntity(entity_id, input.move_dir)) { - if (entity.player_direction != prev_player_direction) { - entity.player_frame_index = 0; - } + if (input.move_dir.x != 0 or input.move_dir.y != 0) { + if (tick_context.moveEntity(entity_id, input.move_dir)) { + if (entity.player_direction != prev_player_direction) { + entity.player_frame_index = 0; + } - self.footstep_sound = Audio.play(self.footstep_buffer, .{ .bus = self.sfx_bus }); + _ = Audio.play(self.footstep_buffer, .{ .bus = self.sfx_bus }); + } else { + _ = Audio.play(self.hit_wall_buffer, .{ .bus = self.sfx_bus }); + entity.visual_pos = entity.visual_pos.add(Vec2.initFromInt(i32, input.move_dir.x, input.move_dir.y).multiplyScalar(0.1)); + entity.player_direction = input.move_dir.toDirection().?; + } } } else if (entity.type == .box) { @@ -947,18 +969,30 @@ pub fn frame(self: *App, plt: *Platform.Frame) !void { self.menu_state = null; } } else if (menu_state == .level_select) { - ui_frame.padding.addHorizontal(30); - ui_frame.padding.addVertical(30); - - var layout = UI.VerticalLayout{ .ui = &ui, .gap = 30 }; + var layout = UI.GridLayout{ + .ui = &ui, + .columns = 8, + .gap = 100 + }; for (0..self.levels.items.len) |i| { const label = try std.fmt.allocPrint(plt.frame, "{}", .{i+1}); - if (layout.textButton(label)) { - self.menu_state = null; - self.setWorldByLevel(i); + const button_rect = layout.next(); + if (self.current_level == i) { + ui.drawTextButton(button_rect, label, .{ + .sprite = self.button_down_sprite, + .sprite_color = .rgb(20, 20, 20), + .text_color = .rgb(200, 200, 200) + }); + } else { + if (ui.textButton(button_rect, label)) { + self.menu_state = null; + self.current_level = @intCast(i); + self.setWorldByLevel(i); + } } + } if (plt.input.isKeyPressed(.ESCAPE)) { diff --git a/src/main.zig b/src/main.zig index b2d7c49..eab891d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -13,7 +13,7 @@ pub fn main(init: std.process.Init) void { Platform.run(App, .{ .init = init, - .window_title = "Gaem", + .window_title = "Sokoban", .width = 800, .height = 600, }); diff --git a/src/platform/root.zig b/src/platform/root.zig index b0e0d33..04d176c 100644 --- a/src/platform/root.zig +++ b/src/platform/root.zig @@ -188,7 +188,8 @@ fn PlatformType(App: type) type { const now = Io.Timestamp.now(self.io, .awake); const time_to_first_frame = self.started_at.durationTo(now); if (time_to_first_frame.nanoseconds > 100 * std.time.ns_per_ms) { - log.warn("Time to first frame is long, {f}", .{time_to_first_frame}); + // TODO: + // log.warn("Time to first frame is long, {f}", .{time_to_first_frame}); } } } diff --git a/src/ui.zig b/src/ui.zig index bc18144..96574ac 100644 --- a/src/ui.zig +++ b/src/ui.zig @@ -97,6 +97,31 @@ pub const VerticalLayout = struct { } }; +pub const GridLayout = struct { + ui: *UI, + columns: u32 = 1, + gap: f32 = 0, + index: u32 = 0, + + pub fn next(self: *GridLayout) Rect { + const container = self.ui.top().container; + const columns_f32: f32 = @floatFromInt(self.columns); + const cell_size = (container.size.x - (self.gap * (columns_f32-1))) / columns_f32; + + const x = self.index % self.columns; + const y = @divFloor(self.index, self.columns); + + const result = Rect{ + .pos = container.pos.add(Vec2.initFromInt(u32, x, y).multiplyScalar(cell_size + self.gap)), + .size = .init(cell_size, cell_size) + }; + + self.index += 1; + + return result; + } +}; + pub const Sides = struct { left: f32, right: f32, @@ -387,10 +412,49 @@ fn squishRect(rect: Rect, sx: f32, sy: f32) Rect { }; } +const DrawTextButtonOptions = struct { + sprite: Gfx.Sprite.Id, + sprite_color: Color = .white, + text_color: ?Color = null, + text_color_lerp_invert: f32 = 0, + text_offset: Vec2 = .zero +}; + +pub fn drawTextButton( + self: *UI, + rect: Rect, + text: []const u8, + opts: DrawTextButtonOptions +) void { + const frame = self.top(); + const font = frame.font orelse return; + + NineRect.draw( + opts.sprite, + rect.pos, + rect.size, + opts.sprite_color + ); + + const content_size = rect.size.sub(frame.padding.toVec2()); + + const text_color = opts.text_color orelse frame.text_color; + + const text_bounds = self.measureText(text); + font.drawText(.{ + .pos = rect.pos + .sub(text_bounds.pos) + .add(.init(frame.padding.left, frame.padding.top)) + .add(content_size.sub(text_bounds.size).multiplyScalar(0.5)) + .add(opts.text_offset), + .text = text, + .height = frame.text_height, + .color = text_color.lerp_invert(opts.text_color_lerp_invert), + }); +} + pub fn textButton(self: *UI, rect: Rect, text: []const u8) bool { const frame = self.top(); - const font = frame.font orelse return false; - const text_bounds = self.measureText(text); const key = Key.initString(@intFromEnum(frame.key), text); const button_state = self.buttonLogic(rect, key); @@ -411,24 +475,11 @@ pub fn textButton(self: *UI, rect: Rect, text: []const u8) bool { 0.06 * hot_t - 0.1 * active_t, -0.09 * hot_t + 0.16 * active_t, ); - NineRect.draw( - sprite, - animated_rect.pos, - animated_rect.size, - Color.white.lerp_invert(-0.2 * hot_t + 0.8 * active_t), - ); - - const content_size = rect.size.sub(frame.padding.toVec2()); - - font.drawText(.{ - .pos = rect.pos - .sub(text_bounds.pos) - .add(.init(frame.padding.left, frame.padding.top)) - .add(content_size.sub(text_bounds.size).multiplyScalar(0.5)) - .add(.init(0, -5 * hot_t + 15 * active_t)), - .text = text, - .height = frame.text_height, - .color = frame.text_color.lerp_invert(hot_t * 0.9 + active_t * 0.1), + self.drawTextButton(animated_rect, text, .{ + .sprite = sprite, + .sprite_color = Color.white.lerp_invert(-0.2 * hot_t + 0.8 * active_t), + .text_color_lerp_invert = hot_t * 0.9 + active_t * 0.1, + .text_offset = .init(0, -5 * hot_t + 15 * active_t) }); const result = button_state == .released;