Moves stuff around, made a main menu and scene mgr

This commit is contained in:
Dan Baker 2025-07-03 14:08:39 +01:00
parent b2e3a3957b
commit 6c023a60a6
37 changed files with 888 additions and 214 deletions

View file

@ -124,7 +124,7 @@ func populate_bush_materials() -> void:
func create_bush_material(color: Color, variation: Color, material_name: String) -> ShaderMaterial:
var material = ShaderMaterial.new()
var shader = load("res://leaves.gdshader")
var shader = load("res://Common/shaders/leaves.gdshader")
material.shader = shader
material.resource_name = material_name

View file

@ -0,0 +1,2 @@
class_name GameManagerClass
extends Node

View file

@ -0,0 +1 @@
uid://cbpayrc0ep538

View file

@ -124,48 +124,12 @@ func generate_map():
func generate_camp():
print("Generating camp...")
var attempts = 0
var placed = false
var camp_x = (map_width - camp_size) / 2
var camp_y = (map_height - camp_size) / 2
while attempts < camp_placement_attempts and not placed:
# Random position with margin to ensure camp fits within map bounds
var margin = camp_size + camp_buffer_zone
var camp_x = randi_range(margin, map_width - margin - camp_size)
var camp_y = randi_range(margin, map_height - margin - camp_size)
# Check if this location is valid for camp placement
if is_valid_camp_location(camp_x, camp_y):
place_camp(camp_x, camp_y)
placed = true
print("Camp placed at (", camp_x, ",", camp_y, ") with size ", camp_size, "x", camp_size)
attempts += 1
if not placed:
print("Could not place camp after ", camp_placement_attempts, " attempts")
# Fallback: place camp in the center of the map
var fallback_x = (map_width - camp_size) / 2
var fallback_y = (map_height - camp_size) / 2
place_camp(fallback_x, fallback_y)
print("Camp placed at fallback location (", fallback_x, ",", fallback_y, ")")
place_camp(camp_x, camp_y)
print("Camp placed at (", camp_x, ",", camp_y, ") with size ", camp_size, "x", camp_size)
func is_valid_camp_location(camp_x: int, camp_y: int) -> bool:
# Check if the camp area and buffer zone are clear
var check_size = camp_size + (camp_buffer_zone * 2)
var start_x = camp_x - camp_buffer_zone
var start_y = camp_y - camp_buffer_zone
for y in range(start_y, start_y + check_size):
for x in range(start_x, start_x + check_size):
if x >= 0 and x < map_width and y >= 0 and y < map_height:
# For now, just check if we're within map bounds
# Later we'll prevent paths and water from being placed here
continue
else:
# Outside map bounds
return false
return true
func place_camp(camp_x: int, camp_y: int):
# Store camp position

View file

@ -0,0 +1,8 @@
class_name SceneManagerClass
extends Node
signal change_scene(scene_name: String)
func load_scene(scene_name: String) -> void:
Log.pr("Sending signal to change scene", scene_name)
emit_signal("change_scene", scene_name)

View file

@ -0,0 +1 @@
uid://c43gwdbpsxxeh