Make monster stand on nodes, other small fixes

This commit is contained in:
Sebastian Morr 2020-10-27 19:44:17 +01:00
parent ea2c731cd3
commit cb7742466b
9 changed files with 36 additions and 30 deletions

View file

@ -116,6 +116,11 @@ delete_word={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
] ]
} }
clear={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":76,"unicode":0,"echo":false,"script":null)
]
}
[network] [network]

View file

@ -14,6 +14,10 @@ func _process(_delta):
if not (repository and repository.objects.has(source)): if not (repository and repository.objects.has(source)):
return return
if repository.objects[source].type == "head":
hide()
set_process(false)
var start = repository.objects[source].position var start = repository.objects[source].position
var end = start + Vector2(0, 60) var end = start + Vector2(0, 60)

View file

@ -62,7 +62,7 @@ func arrange_cards():
yield(t, "timeout") yield(t, "timeout")
var amount_cards = get_tree().get_nodes_in_group("cards").size() var amount_cards = get_tree().get_nodes_in_group("cards").size()
var total_angle = min(50, 45.0/7*amount_cards) var total_angle = min(35, 45.0/7*amount_cards)
var angle_between_cards = 0 var angle_between_cards = 0
if amount_cards > 1: if amount_cards > 1:
angle_between_cards = total_angle / (amount_cards-1) angle_between_cards = total_angle / (amount_cards-1)

View file

@ -116,6 +116,7 @@ __meta__ = {
} }
[node name="CardsButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"] [node name="CardsButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
visible = false
margin_left = 406.0 margin_left = 406.0
margin_right = 478.0 margin_right = 478.0
margin_bottom = 35.0 margin_bottom = 35.0
@ -127,8 +128,8 @@ __meta__ = {
} }
[node name="NextLevelButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"] [node name="NextLevelButton" type="Button" parent="Rows/Columns/RightSide/LevelInfo/Menu"]
margin_left = 483.0 margin_left = 406.0
margin_right = 593.0 margin_right = 516.0
margin_bottom = 35.0 margin_bottom = 35.0
focus_mode = 0 focus_mode = 0
custom_styles/hover = SubResource( 1 ) custom_styles/hover = SubResource( 1 )
@ -222,6 +223,7 @@ size_flags_vertical = 3
[node name="SuccessSound" type="AudioStreamPlayer" parent="."] [node name="SuccessSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 8 ) stream = ExtResource( 8 )
volume_db = -10.0
[connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/ChapterSelect" to="." method="repopulate_chapters"] [connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/ChapterSelect" to="." method="repopulate_chapters"]
[connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/LevelSelect" to="." method="repopulate_levels"] [connection signal="button_down" from="Rows/Columns/RightSide/LevelInfo/Menu/LevelSelect" to="." method="repopulate_levels"]
[connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/ReloadButton" to="." method="reload_level"] [connection signal="pressed" from="Rows/Columns/RightSide/LevelInfo/Menu/ReloadButton" to="." method="reload_level"]

View file

@ -24,7 +24,7 @@ func _ready():
$Pop.pitch_scale = rand_range(0.8, 1.2) $Pop.pitch_scale = rand_range(0.8, 1.2)
$Pop.play() $Pop.play()
func _process(_delta): func _process(delta):
if held: if held:
if not Input.is_action_pressed("click"): if not Input.is_action_pressed("click"):
held = false held = false
@ -32,6 +32,14 @@ func _process(_delta):
global_position = get_global_mouse_position() global_position = get_global_mouse_position()
if visible: if visible:
if type == "head":
for c in children:
if repository.objects.has(c):
var other = repository.objects[c]
var offset = Vector2(0, -45)
var target_position = other.position + offset
position = lerp(position, target_position, 10*delta)
else:
apply_forces() apply_forces()
func apply_forces(): func apply_forces():
@ -80,6 +88,7 @@ func type_set(new_type):
"head": "head":
$Sprite.texture = preload("res://nodes/head.svg") $Sprite.texture = preload("res://nodes/head.svg")
id_always_visible = false id_always_visible = false
z_index = 1
if id_always_visible: if id_always_visible:
$ID.show() $ID.show()

View file

@ -20,7 +20,6 @@ var mouse_inside = false
var _commit_count = 0 var _commit_count = 0
func _ready(): func _ready():
# Trigger these again because nodes were not ready before. # Trigger these again because nodes were not ready before.
set_label(label) set_label(label)
set_simplified_view(simplified_view) set_simplified_view(simplified_view)
@ -73,6 +72,8 @@ func get_path():
func set_label(new_label): func set_label(new_label):
label = new_label label = new_label
if label_node: if label_node:
if new_label == "yours":
new_label = ""
label_node.text = new_label label_node.text = new_label
func random_position(): func random_position():
@ -163,10 +164,10 @@ func update_refs():
func apply_forces(): func apply_forces():
for o in objects.values(): for o in objects.values():
if not o.visible: if not o.visible or o.type == "head":
continue continue
for o2 in objects.values(): for o2 in objects.values():
if o == o2 or not o2.visible: if o == o2 or not o2.visible or o2.type == "head":
continue continue
var d = o.position.distance_to(o2.position) var d = o.position.distance_to(o2.position)
var dir = (o.global_position - o2.global_position).normalized() var dir = (o.global_position - o2.global_position).normalized()

View file

@ -63,6 +63,8 @@ func _input(event):
input.caret_position = idx+1 input.caret_position = idx+1
else: else:
input.text = "" + second_half input.text = "" + second_half
if event.is_action_pressed("clear"):
clear()
func load_command(id): func load_command(id):
input.text = premade_commands[id] input.text = premade_commands[id]

View file

@ -1,6 +1,5 @@
[gd_scene load_steps=10 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
[ext_resource path="res://sounds/typewriter_ding.wav" type="AudioStream" id=2] [ext_resource path="res://sounds/typewriter_ding.wav" type="AudioStream" id=2]
[ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=3] [ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=3]
[ext_resource path="res://scenes/terminal.gd" type="Script" id=4] [ext_resource path="res://scenes/terminal.gd" type="Script" id=4]
@ -8,7 +7,6 @@
[ext_resource path="res://scenes/tcp_server.tscn" type="PackedScene" id=6] [ext_resource path="res://scenes/tcp_server.tscn" type="PackedScene" id=6]
[ext_resource path="res://sounds/buzzer.wav" type="AudioStream" id=7] [ext_resource path="res://sounds/buzzer.wav" type="AudioStream" id=7]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 5.0 content_margin_left = 5.0
content_margin_right = 5.0 content_margin_right = 5.0
@ -69,7 +67,7 @@ __meta__ = {
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_top = -311.0 margin_top = -34.0
columns = 2 columns = 2
hide_root = true hide_root = true
__meta__ = { __meta__ = {
@ -116,21 +114,6 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="ClearButton" type="Button" parent="."]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -88.0
margin_top = 5.0
margin_right = -5.0
margin_bottom = 36.0
focus_mode = 0
custom_fonts/font = ExtResource( 1 )
enabled_focus_mode = 0
text = "Clear"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextEditor" parent="." instance=ExtResource( 5 )] [node name="TextEditor" parent="." instance=ExtResource( 5 )]
visible = false visible = false
mouse_filter = 1 mouse_filter = 1
@ -168,6 +151,5 @@ stream = ExtResource( 2 )
[connection signal="pressed" from="Rows/VBoxContainer/Button3" to="Rows/VBoxContainer/Button3" method="pressed"] [connection signal="pressed" from="Rows/VBoxContainer/Button3" to="Rows/VBoxContainer/Button3" method="pressed"]
[connection signal="text_changed" from="Rows/InputLine/Input" to="." method="_input_changed"] [connection signal="text_changed" from="Rows/InputLine/Input" to="." method="_input_changed"]
[connection signal="text_entered" from="Rows/InputLine/Input" to="." method="send_command"] [connection signal="text_entered" from="Rows/InputLine/Input" to="." method="send_command"]
[connection signal="pressed" from="ClearButton" to="." method="clear"]
[connection signal="saved" from="TextEditor" to="." method="editor_saved"] [connection signal="saved" from="TextEditor" to="." method="editor_saved"]
[connection signal="data_received" from="TCPServer" to="." method="receive_output"] [connection signal="data_received" from="TCPServer" to="." method="receive_output"]

View file

@ -10,17 +10,18 @@ script = ExtResource( 2 )
[node name="Line" type="Line2D" parent="."] [node name="Line" type="Line2D" parent="."]
z_index = -1 z_index = -1
points = PoolVector2Array( -0.480499, -0.11055, 158.301, 0.581757 ) points = PoolVector2Array( -0.480499, -0.11055, 158.301, 0.581757 )
default_color = Color( 0.811765, 0.811765, 0.811765, 1 ) default_color = Color( 0.760784, 0.74902, 0.14902, 1 )
[node name="Tip" type="Node2D" parent="."] [node name="Tip" type="Node2D" parent="."]
position = Vector2( 0.175903, -0.0836948 ) position = Vector2( 0.175903, -0.0836948 )
rotation = -0.0733038
z_index = 1 z_index = 1
[node name="Polygon" type="Polygon2D" parent="Tip"] [node name="Polygon" type="Polygon2D" parent="Tip"]
position = Vector2( -0.0332336, 0.422104 ) position = Vector2( -0.0332336, 0.422104 )
rotation = 2.86234 rotation = 2.86234
z_index = -1 z_index = -1
color = Color( 0.811765, 0.811765, 0.811765, 1 ) color = Color( 0.760784, 0.74902, 0.14902, 1 )
offset = Vector2( -52.4162, -12.5157 ) offset = Vector2( -52.4162, -12.5157 )
polygon = PoolVector2Array( -8.50021, 20.4619, 36.1874, 8.44903, 0.869781, -21.8232 ) polygon = PoolVector2Array( -8.50021, 20.4619, 36.1874, 8.44903, 0.869781, -21.8232 )