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
|
@ -33,24 +33,26 @@ func _input(event):
|
|||
if event.is_action_pressed("save"):
|
||||
if text_edit.visible:
|
||||
save()
|
||||
var speed = 30
|
||||
if event.is_action_pressed("down", true):
|
||||
player.move(Vector2(0,speed))
|
||||
if event.is_action_pressed("up", true):
|
||||
player.move(Vector2(0,-speed))
|
||||
if event.is_action_pressed("right", true):
|
||||
player.move(Vector2(speed, 0))
|
||||
if event.is_action_pressed("left", true):
|
||||
player.move(Vector2(-speed,0))
|
||||
if event.is_action_pressed("pickup"):
|
||||
if player.held:
|
||||
player.held = null
|
||||
else:
|
||||
for item in world.get_children():
|
||||
if item != player:
|
||||
if item.position.distance_to(player.position) < 50:
|
||||
player.held = item
|
||||
print("player picked up item " + item.label)
|
||||
|
||||
if has_focus():
|
||||
var speed = 30
|
||||
if event.is_action_pressed("down", true):
|
||||
player.move(Vector2(0,speed))
|
||||
if event.is_action_pressed("up", true):
|
||||
player.move(Vector2(0,-speed))
|
||||
if event.is_action_pressed("right", true):
|
||||
player.move(Vector2(speed, 0))
|
||||
if event.is_action_pressed("left", true):
|
||||
player.move(Vector2(-speed,0))
|
||||
if event.is_action_pressed("pickup"):
|
||||
if player.held:
|
||||
player.held = null
|
||||
else:
|
||||
for item in world.get_children():
|
||||
if item != player:
|
||||
if item.position.distance_to(player.position) < 50:
|
||||
player.held = item
|
||||
print("player picked up item " + item.label)
|
||||
|
||||
func clear():
|
||||
pass
|
||||
|
@ -238,11 +240,6 @@ func _set_title(new_title):
|
|||
if title_label:
|
||||
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):
|
||||
if a[0] == "." and b[0] != ".":
|
||||
return false
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_min_size = Vector2( 0, 142 )
|
||||
focus_mode = 2
|
||||
theme = ExtResource( 3 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
|
@ -19,6 +20,7 @@ __meta__ = {
|
|||
[node name="Panel" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
@ -26,6 +28,7 @@ __meta__ = {
|
|||
[node name="Margin" type="MarginContainer" parent="Panel"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 1
|
||||
custom_constants/margin_right = 8
|
||||
custom_constants/margin_top = 8
|
||||
custom_constants/margin_left = 8
|
||||
|
@ -73,6 +76,7 @@ text = "dir"
|
|||
margin_top = 29.0
|
||||
margin_right = 1904.0
|
||||
margin_bottom = 1064.0
|
||||
mouse_filter = 1
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
|
|
Loading…
Reference in a new issue