update obstacle to simplify with neighboor
This commit is contained in:
+14
-7
@@ -67,8 +67,8 @@ enum ActionState {
|
||||
}
|
||||
|
||||
# Obstacle
|
||||
var current_obstacle_direction = ObstacleDirection.VERTICAL
|
||||
var obstacle_item_index = 12 # Default obstacle item index in mesh library
|
||||
# Add these properties to track the current obstacle direction
|
||||
var current_obstacle_direction = EnhancedGridMap.Direction.NORTH # Default to NORTH
|
||||
var current_obstacle_item = 12 # Starting with first obstacle item (12)
|
||||
|
||||
enum ObstacleDirection {
|
||||
@@ -997,12 +997,11 @@ func setup_obstacle_ui():
|
||||
obstacle_button.pressed.connect(func(): set_action_state(ActionState.PLACING_OBSTACLE))
|
||||
$ActionMenu/ActionButtonContainer.add_child(obstacle_button)
|
||||
|
||||
# Create the direction toggle button
|
||||
# Create the direction cycle button
|
||||
var direction_button = Button.new()
|
||||
direction_button.text = "Direction: Vertical"
|
||||
direction_button.text = "Direction: North"
|
||||
direction_button.pressed.connect(func():
|
||||
current_obstacle_direction = ObstacleDirection.HORIZONTAL if current_obstacle_direction == ObstacleDirection.VERTICAL else ObstacleDirection.VERTICAL
|
||||
direction_button.text = "Direction: " + ("Horizontal" if current_obstacle_direction == ObstacleDirection.HORIZONTAL else "Vertical")
|
||||
direction_button.text = cycle_obstacle_direction()
|
||||
)
|
||||
$ActionMenu/ActionButtonContainer.add_child(direction_button)
|
||||
|
||||
@@ -1014,7 +1013,6 @@ func setup_obstacle_ui():
|
||||
)
|
||||
$ActionMenu/ActionButtonContainer.add_child(type_button)
|
||||
|
||||
|
||||
# Add a function to cycle through obstacle types
|
||||
func cycle_obstacle_type():
|
||||
var obstacle_types = [12, 13, 14, 15]
|
||||
@@ -1023,6 +1021,15 @@ func cycle_obstacle_type():
|
||||
current_obstacle_item = obstacle_types[current_index]
|
||||
return "Type: " + str(current_index + 1)
|
||||
|
||||
func cycle_obstacle_direction():
|
||||
var directions = [EnhancedGridMap.Direction.NORTH, EnhancedGridMap.Direction.EAST, EnhancedGridMap.Direction.SOUTH, EnhancedGridMap.Direction.WEST]
|
||||
var current_index = directions.find(current_obstacle_direction)
|
||||
current_index = (current_index + 1) % directions.size()
|
||||
current_obstacle_direction = directions[current_index]
|
||||
|
||||
var direction_names = ["North", "East", "South", "West"]
|
||||
return "Direction: " + direction_names[current_index]
|
||||
|
||||
func update_board_slot(board_ui: Node, slot_idx: int, value: int):
|
||||
var slot_node = board_ui.get_node_or_null("Slot%d" % (slot_idx + 1))
|
||||
if slot_node:
|
||||
|
||||
Reference in New Issue
Block a user