mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-22 16:20:19 +01:00
Either world or terminal has focus
This commit is contained in:
parent
96e4c56521
commit
b7710e1422
2 changed files with 25 additions and 24 deletions
|
@ -28,29 +28,31 @@ func _ready():
|
||||||
_set_title(title)
|
_set_title(title)
|
||||||
$PopupMenu.add_item("New file", 1)
|
$PopupMenu.add_item("New file", 1)
|
||||||
#player.file_browser = self
|
#player.file_browser = self
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event.is_action_pressed("save"):
|
if event.is_action_pressed("save"):
|
||||||
if text_edit.visible:
|
if text_edit.visible:
|
||||||
save()
|
save()
|
||||||
var speed = 30
|
|
||||||
if event.is_action_pressed("down", true):
|
if has_focus():
|
||||||
player.move(Vector2(0,speed))
|
var speed = 30
|
||||||
if event.is_action_pressed("up", true):
|
if event.is_action_pressed("down", true):
|
||||||
player.move(Vector2(0,-speed))
|
player.move(Vector2(0,speed))
|
||||||
if event.is_action_pressed("right", true):
|
if event.is_action_pressed("up", true):
|
||||||
player.move(Vector2(speed, 0))
|
player.move(Vector2(0,-speed))
|
||||||
if event.is_action_pressed("left", true):
|
if event.is_action_pressed("right", true):
|
||||||
player.move(Vector2(-speed,0))
|
player.move(Vector2(speed, 0))
|
||||||
if event.is_action_pressed("pickup"):
|
if event.is_action_pressed("left", true):
|
||||||
if player.held:
|
player.move(Vector2(-speed,0))
|
||||||
player.held = null
|
if event.is_action_pressed("pickup"):
|
||||||
else:
|
if player.held:
|
||||||
for item in world.get_children():
|
player.held = null
|
||||||
if item != player:
|
else:
|
||||||
if item.position.distance_to(player.position) < 50:
|
for item in world.get_children():
|
||||||
player.held = item
|
if item != player:
|
||||||
print("player picked up item " + item.label)
|
if item.position.distance_to(player.position) < 50:
|
||||||
|
player.held = item
|
||||||
|
print("player picked up item " + item.label)
|
||||||
|
|
||||||
func clear():
|
func clear():
|
||||||
pass
|
pass
|
||||||
|
@ -237,11 +239,6 @@ func _set_title(new_title):
|
||||||
title = new_title
|
title = new_title
|
||||||
if title_label:
|
if title_label:
|
||||||
title_label.text = new_title
|
title_label.text = new_title
|
||||||
|
|
||||||
func _gui_input(event):
|
|
||||||
if event is InputEventMouseButton and event.is_pressed() and event.button_index == BUTTON_RIGHT:
|
|
||||||
$PopupMenu.set_position(get_global_mouse_position())
|
|
||||||
$PopupMenu.popup()
|
|
||||||
|
|
||||||
func very_best_sort(a,b):
|
func very_best_sort(a,b):
|
||||||
if a[0] == "." and b[0] != ".":
|
if a[0] == "." and b[0] != ".":
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
rect_min_size = Vector2( 0, 142 )
|
rect_min_size = Vector2( 0, 142 )
|
||||||
|
focus_mode = 2
|
||||||
theme = ExtResource( 3 )
|
theme = ExtResource( 3 )
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
|
@ -19,6 +20,7 @@ __meta__ = {
|
||||||
[node name="Panel" type="Panel" parent="."]
|
[node name="Panel" type="Panel" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 1
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
@ -26,6 +28,7 @@ __meta__ = {
|
||||||
[node name="Margin" type="MarginContainer" parent="Panel"]
|
[node name="Margin" type="MarginContainer" parent="Panel"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 1
|
||||||
custom_constants/margin_right = 8
|
custom_constants/margin_right = 8
|
||||||
custom_constants/margin_top = 8
|
custom_constants/margin_top = 8
|
||||||
custom_constants/margin_left = 8
|
custom_constants/margin_left = 8
|
||||||
|
@ -73,6 +76,7 @@ text = "dir"
|
||||||
margin_top = 29.0
|
margin_top = 29.0
|
||||||
margin_right = 1904.0
|
margin_right = 1904.0
|
||||||
margin_bottom = 1064.0
|
margin_bottom = 1064.0
|
||||||
|
mouse_filter = 1
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue