diff --git a/arenas/normal1.tscn b/arenas/normal1.tscn index a1a80b7..d15d44c 100644 --- a/arenas/normal1.tscn +++ b/arenas/normal1.tscn @@ -68,7 +68,7 @@ start = NodePath("../../anchors/anchor20") end = NodePath("../../anchors/anchor14") [node name="route33" parent="routes" instance=ExtResource( 2 )] -points = PoolVector2Array( 780, 300, 544, 184 ) +points = PoolVector2Array( 780, 300, 540, 180 ) start = NodePath("../../anchors/anchor12") end = NodePath("../../anchors/anchor16") @@ -78,7 +78,7 @@ start = NodePath("../../anchors/anchor12") end = NodePath("../../anchors/anchor20") [node name="route43" parent="routes" instance=ExtResource( 2 )] -points = PoolVector2Array( 540, 420, 544, 184 ) +points = PoolVector2Array( 540, 420, 540, 180 ) start = NodePath("../../anchors/anchor20") end = NodePath("../../anchors/anchor16") @@ -213,12 +213,12 @@ start = NodePath("../../anchors/anchor15") end = NodePath("../../anchors/anchor13") [node name="route36" parent="routes" instance=ExtResource( 2 )] -points = PoolVector2Array( 544, 184, 300, 300 ) +points = PoolVector2Array( 540, 180, 300, 300 ) start = NodePath("../../anchors/anchor16") end = NodePath("../../anchors/anchor13") [node name="route50" parent="routes" instance=ExtResource( 2 )] -points = PoolVector2Array( 544, 184, 300, 300 ) +points = PoolVector2Array( 540, 180, 300, 300 ) start = NodePath("../../anchors/anchor16") end = NodePath("../../anchors/anchor13") @@ -321,7 +321,7 @@ position = Vector2( 900, 480 ) position = Vector2( 180, 480 ) [node name="anchor16" parent="anchors" instance=ExtResource( 1 )] -position = Vector2( 544, 184 ) +position = Vector2( 540, 180 ) [node name="anchor17" parent="anchors" instance=ExtResource( 1 )] position = Vector2( 960, 720 ) diff --git a/tests/unit_move.tscn b/tests/unit_move.tscn new file mode 100644 index 0000000..8f23f07 --- /dev/null +++ b/tests/unit_move.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://arenas/anchor.tscn" type="PackedScene" id=1] +[ext_resource path="res://arenas/route.tscn" type="PackedScene" id=2] +[ext_resource path="res://units/creeper.tscn" type="PackedScene" id=3] + +[node name="Node2D" type="Node2D"] + +[node name="route" parent="." instance=ExtResource( 2 )] +points = PoolVector2Array( 300, 900, 800, 900 ) +start = NodePath("../anchor") +end = NodePath("../anchor2") + +[node name="route2" parent="." instance=ExtResource( 2 )] +points = PoolVector2Array( 800, 900, 550, 1200 ) +start = NodePath("../anchor2") +end = NodePath("../anchor3") + +[node name="route3" parent="." instance=ExtResource( 2 )] +points = PoolVector2Array( 550, 1200, 300, 900 ) +start = NodePath("../anchor3") +end = NodePath("../anchor") + +[node name="anchor" parent="." instance=ExtResource( 1 )] +position = Vector2( 300, 900 ) +content = NodePath("creeper") + +[node name="creeper" parent="anchor" instance=ExtResource( 3 )] +modulate = Color( 1, 1, 1, 1 ) +attacker = true +playable = true + +[node name="anchor2" parent="." instance=ExtResource( 1 )] +position = Vector2( 800, 900 ) + +[node name="anchor3" parent="." instance=ExtResource( 1 )] +position = Vector2( 550, 1200 ) diff --git a/units/base_unit.gd b/units/base_unit.gd index 5206414..b4d563f 100644 --- a/units/base_unit.gd +++ b/units/base_unit.gd @@ -101,7 +101,11 @@ func play(anchor): func move_to(anchor): if $points.move: $points.move -= 1 + var position = rect_global_position anchor.set_content(self) + rect_position = position - anchor.position + $sprite.rotation = atan2(-rect_position.y, -rect_position.x) + AnimHelper.linear_goto(self, Vector2(-50, -50)) func get_points() -> UnitPoints: if $points is UnitPoints: diff --git a/units/base_unit.tscn b/units/base_unit.tscn index 336cbbb..870bd18 100644 --- a/units/base_unit.tscn +++ b/units/base_unit.tscn @@ -6,6 +6,7 @@ [ext_resource path="res://theme/ui.tres" type="Theme" id=4] [node name="unit" type="Panel"] +modulate = Color( 0.5, 0.5, 0.5, 1 ) self_modulate = Color( 1, 1, 1, 0 ) margin_left = -50.0 margin_top = -50.0 @@ -23,7 +24,7 @@ position = Vector2( 50, 50 ) texture = ExtResource( 2 ) [node name="points" parent="." instance=ExtResource( 3 )] -modulate = Color( 1, 0.5, 0.5, 1 ) +modulate = Color( 1, 0.3, 0.3, 1 ) anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5