2022-10-20 23:16:48 +00:00
|
|
|
[gd_scene load_steps=8 format=3 uid="uid://c6omib6txy3qh"]
|
2022-10-06 13:41:45 +00:00
|
|
|
|
|
|
|
[ext_resource type="PackedScene" uid="uid://brbtq46uk18gg" path="res://core/battlefield.tscn" id="1_x63ik"]
|
2022-10-05 23:21:40 +00:00
|
|
|
[ext_resource type="PackedScene" uid="uid://dqaabctftkakr" path="res://core/player.tscn" id="2_o4smw"]
|
2022-10-06 13:41:45 +00:00
|
|
|
[ext_resource type="PackedScene" uid="uid://b8uik6q4v35o3" path="res://tac/units/factory.tscn" id="2_wnc50"]
|
2022-10-20 23:16:48 +00:00
|
|
|
[ext_resource type="PackedScene" uid="uid://xoup4vukp3ni" path="res://core/ui/commands.tscn" id="4_1gkbi"]
|
|
|
|
[ext_resource type="PackedScene" uid="uid://dr1e0h27nuam" path="res://tac/commands/delivery.tscn" id="5_fi2mi"]
|
2022-10-06 13:41:45 +00:00
|
|
|
|
2022-10-06 04:23:41 +00:00
|
|
|
[sub_resource type="GDScript" id="GDScript_8ehhf"]
|
|
|
|
script/source = "extends Camera2D
|
|
|
|
|
|
|
|
var raw_zoom := 0
|
|
|
|
|
|
|
|
func scroll(diff: Vector2):
|
|
|
|
position -= diff
|
|
|
|
|
|
|
|
func change_zoom(diff: float):
|
|
|
|
raw_zoom = clampf(raw_zoom + diff, -2, 2)
|
|
|
|
|
|
|
|
var z := pow(2.0, raw_zoom)
|
|
|
|
zoom = Vector2(z, z)
|
|
|
|
"
|
|
|
|
|
|
|
|
[sub_resource type="GDScript" id="GDScript_0auct"]
|
|
|
|
script/source = "extends Control
|
|
|
|
|
|
|
|
signal scrolled(diff)
|
|
|
|
signal zoomed(diff)
|
|
|
|
|
2022-10-20 23:16:48 +00:00
|
|
|
func _unhandled_input(event):
|
2022-10-06 04:23:41 +00:00
|
|
|
if event is InputEventMouseMotion:
|
|
|
|
if event.button_mask & MOUSE_BUTTON_LEFT:
|
|
|
|
scrolled.emit(event.relative)
|
2022-10-20 23:16:48 +00:00
|
|
|
accept_event()
|
2022-10-06 04:23:41 +00:00
|
|
|
if event is InputEventMouseButton and event.pressed:
|
|
|
|
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
|
|
|
zoomed.emit(signf(event.factor))
|
2022-10-20 23:16:48 +00:00
|
|
|
accept_event()
|
2022-10-06 04:23:41 +00:00
|
|
|
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
|
|
|
zoomed.emit(-signf(event.factor))
|
2022-10-20 23:16:48 +00:00
|
|
|
accept_event()
|
2022-10-19 22:02:02 +00:00
|
|
|
"
|
|
|
|
|
2022-10-06 13:41:45 +00:00
|
|
|
[node name="main" type="Node2D"]
|
|
|
|
|
2022-10-06 04:23:41 +00:00
|
|
|
[node name="camera" type="Camera2D" parent="."]
|
|
|
|
position = Vector2(640, 360)
|
|
|
|
current = true
|
|
|
|
script = SubResource("GDScript_8ehhf")
|
|
|
|
|
2022-10-06 13:41:45 +00:00
|
|
|
[node name="battlefield" parent="." instance=ExtResource("1_x63ik")]
|
|
|
|
|
2022-10-05 23:21:40 +00:00
|
|
|
[node name="player1" parent="battlefield" instance=ExtResource("2_o4smw")]
|
|
|
|
color = Color(0, 0, 1, 1)
|
|
|
|
code = "p1"
|
|
|
|
|
|
|
|
[node name="player2" parent="battlefield" instance=ExtResource("2_o4smw")]
|
|
|
|
color = Color(1, 0, 0, 1)
|
|
|
|
code = "p2"
|
|
|
|
|
|
|
|
[node name="factory1" parent="battlefield" node_paths=PackedStringArray("player") instance=ExtResource("2_wnc50")]
|
|
|
|
position = Vector2(270, 222)
|
|
|
|
player = NodePath("../player1")
|
|
|
|
|
|
|
|
[node name="factory2" parent="battlefield" node_paths=PackedStringArray("player") instance=ExtResource("2_wnc50")]
|
|
|
|
position = Vector2(929, 429)
|
|
|
|
player = NodePath("../player2")
|
2022-10-06 13:41:45 +00:00
|
|
|
|
2022-10-20 23:16:48 +00:00
|
|
|
[node name="commands" parent="." node_paths=PackedStringArray("player") instance=ExtResource("4_1gkbi")]
|
|
|
|
player = NodePath("../battlefield/player1")
|
|
|
|
available_commands = [ExtResource("5_fi2mi")]
|
|
|
|
|
2022-10-06 13:41:45 +00:00
|
|
|
[node name="ui" type="CanvasLayer" parent="."]
|
2022-10-20 23:16:48 +00:00
|
|
|
layer = 3
|
2022-10-06 04:23:41 +00:00
|
|
|
|
|
|
|
[node name="camcontrol" type="Control" parent="ui"]
|
|
|
|
layout_mode = 3
|
|
|
|
anchors_preset = 15
|
|
|
|
anchor_right = 1.0
|
|
|
|
anchor_bottom = 1.0
|
|
|
|
grow_horizontal = 2
|
|
|
|
grow_vertical = 2
|
|
|
|
size_flags_horizontal = 3
|
|
|
|
size_flags_vertical = 3
|
2022-10-20 23:16:48 +00:00
|
|
|
mouse_filter = 2
|
2022-10-06 04:23:41 +00:00
|
|
|
mouse_force_pass_scroll_events = false
|
|
|
|
script = SubResource("GDScript_0auct")
|
|
|
|
|
2022-10-20 23:16:48 +00:00
|
|
|
[connection signal="commands_changed" from="commands" to="battlefield" method="_on_commands_changed"]
|
2022-10-06 04:23:41 +00:00
|
|
|
[connection signal="scrolled" from="ui/camcontrol" to="camera" method="scroll"]
|
|
|
|
[connection signal="zoomed" from="ui/camcontrol" to="camera" method="change_zoom"]
|