feat: Make the street width be a global variable
This commit is contained in:
parent
2b4a2b937e
commit
21cee8ebd8
9
chunk.gd
9
chunk.gd
|
|
@ -3,7 +3,6 @@ extends Node3D
|
|||
|
||||
var exits: Array = [false, false, false, false]
|
||||
|
||||
const STREET_WIDTH: float = 40
|
||||
const ASPHALT_WIDTH: float = 20
|
||||
@onready var exit_area = $BuildingAreas/B_area_E/Collision
|
||||
@onready var building_area = $BuildingAreas/B_area/Collision
|
||||
|
|
@ -13,14 +12,14 @@ func _ready() -> void:
|
|||
$Mesh.mesh.size.x = Global.chunk_size
|
||||
$Mesh.mesh.size.y = Global.chunk_size
|
||||
|
||||
var building_side = (Global.chunk_size - STREET_WIDTH) / 2
|
||||
var building_center = (building_side + STREET_WIDTH) / 2
|
||||
var building_side = (Global.chunk_size - Global.street_width) / 2
|
||||
var building_center = (building_side + Global.street_width) / 2
|
||||
building_area.shape.size.z = building_side
|
||||
building_area.shape.size.x = building_side
|
||||
building_area.position.x = building_center
|
||||
building_area.position.z = building_center
|
||||
|
||||
exit_area.shape.size.z = STREET_WIDTH
|
||||
exit_area.shape.size.z = Global.street_width
|
||||
exit_area.shape.size.x = building_side
|
||||
|
||||
var pavement_side = (Global.chunk_size - ASPHALT_WIDTH) / 2
|
||||
|
|
@ -32,7 +31,7 @@ func _ready() -> void:
|
|||
$BuildingAreas/B_area_E/Pavement.mesh.size.z = Global.chunk_size
|
||||
$BuildingAreas/B_area_E/Pavement.mesh.size.x = pavement_side
|
||||
|
||||
var z_correction_factor = STREET_WIDTH / 40
|
||||
var z_correction_factor = Global.street_width / 40
|
||||
var x_correction_factor = building_side / 55
|
||||
for st_body in $BuildingAreas.get_children():
|
||||
st_body.get_node("Collision").position.x = building_center
|
||||
|
|
|
|||
Loading…
Reference in New Issue