finished belts. Some random errors in corners...
Build Godot Project (Linux & Windows) / build-linux (push) Successful in 29s
Build Godot Project (Linux & Windows) / build-windows (push) Successful in 32s

This commit is contained in:
2026-06-22 21:21:32 -06:00
parent d802c901ac
commit 2776482c21
5 changed files with 37 additions and 23 deletions
+9 -1
View File
@@ -17,8 +17,10 @@ func _process(delta: float) -> void:
func setup(pos, dir):
map_position = pos
facing_direction = dir
self.rotate(-PI / 2 * facing_direction)
func collect(input_value: int):
if empty:
$value_text.text = str(input_value)
$value_text.show()
empty = false
@@ -27,7 +29,7 @@ func collect(input_value: int):
func move():
#print("Moving item")
move_timer += 1
$value_text.position[1] = -30 + (move_timer * 2)
$value_text.position[1] = -14 + (move_timer * 2)
if move_timer > 15:
move_timer = 0
empty = true
@@ -35,5 +37,11 @@ func move():
var next_pos = map_position
if facing_direction == 0:
next_pos[1] += 1
elif facing_direction == 1:
next_pos[0] += 1
elif facing_direction == 2:
next_pos[1] -= 1
elif facing_direction == 3:
next_pos[0] -= 1
return [next_pos, value]
return
+2 -2
View File
@@ -11,9 +11,9 @@ script = ExtResource("2_rfspg")
visible = false
z_index = 1
offset_left = -14.0
offset_top = -30.0
offset_top = -14.0
offset_right = 14.0
offset_bottom = -7.0
offset_bottom = 9.0
theme_override_colors/font_color = Color(0.23529412, 0, 0.8862745, 1)
text = "-99"
horizontal_alignment = 1
+2 -2
View File
@@ -6,8 +6,8 @@ var producer_value: int
func _ready() -> void:
print("Placed Extractor at: (%s, %s)" % [self.global_position[0], self.global_position[1]])
func setup(value):
producer_value = value
func setup(setup_value):
producer_value = setup_value
print("extractor value set as %s" % producer_value)
# Called every frame. 'delta' is the elapsed time since the previous frame.
+14 -9
View File
@@ -14,6 +14,7 @@ const DELETE_SCENE = preload("res://delete.tscn")
enum Mode { NONE, PLACE_EXTRACTOR, PLACE_BELT, PLACE_ADDER, DELETE }
var current_mode = Mode.NONE
var current_direction = 0
var preview_item: Node2D = null # Holds the visual for the mouse
# These should likely be changed to be the same format as above
@@ -67,6 +68,14 @@ func _input(event):
elif event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
clear_preview()
current_mode = Mode.NONE
if event is InputEventKey and event.pressed:
print('key pressed')
if event.keycode == KEY_BRACKETLEFT:
current_direction = (current_direction + 1) % 4
preview_item.rotate(-PI / 2)
elif event.keycode == KEY_BRACKETRIGHT:
current_direction = (current_direction - 1) % 4
preview_item.rotate(+PI / 2)
# Returns the grid position of the mouse
@@ -136,14 +145,6 @@ func process_grid_data_at(coords: Vector2i) -> void:
# Formula: Start at 1, add 1 extra value for every 10 tiles away
var producer_value = 1 + floor(distance / 10.0)
# Register the producer in our global data registry
# disabled: for x in range(-1, 2):
# disabled: for y in range(-1, 2):
# disabled: grid_data[coords + Vector2i(x, y)] = {
# disabled: "type": "producer",
# disabled: "value": producer_value
# disabled: }
grid_data[coords] = [{
"type": "producer",
@@ -169,6 +170,7 @@ func set_preview_mode(mode_type: Mode, scene_to_preview: PackedScene):
if scene_to_preview:
preview_item = scene_to_preview.instantiate()
preview_item.rotate(-PI / 2 * current_direction)
# Optional: Make the preview slightly transparent
preview_item.modulate.a = 0.5
add_child(preview_item)
@@ -213,7 +215,7 @@ func place_item(item: PackedScene):
if item == EXTRACTOR_SCENE:
new_item.setup(object_at_coords['value'])
elif item == BELT_SCENE:
new_item.setup(spawn_pos, 0)
new_item.setup(spawn_pos, current_direction)
else:
print("No custom setup for %s" % item)
@@ -242,7 +244,10 @@ func register_object_at_coordinate(coords: Vector2i, object_data: Dictionary) ->
grid_data[coords] = [object_data]
func delete_object_at_coordinate(coords: Vector2i):
if grid_data.has(coords):
grid_data[coords].pop_back()
if grid_data[coords] == []:
grid_data.erase(coords)
# --- UI Button Signals ---
+4 -3
View File
@@ -2,13 +2,14 @@ extends Sprite2D
var output_value: int
func setup(output_value):
func setup(out_value):
$tooltip.hide()
print("Producer spawned physically with a value of: ", output_value)
$text_value.text = str(output_value)
print("Producer spawned physically with a value of: ", out_value)
$text_value.text = str(out_value)
$tooltip.text = "Placed at: (%s, %s)" % [self.global_position[0], self.global_position[1]]
print($tooltip.size )
$tooltip.size = Vector2i(100, 100)
output_value = out_value
# Called when the node enters the scene tree for the first time.
func _ready() -> void: