Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion linux/icon-256.png
Git LFS file not shown
111 changes: 32 additions & 79 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,38 @@ ui_cancel={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
]
}
ui_left={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
]
}
ui_right={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
]
}
ui_up={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
]
}
ui_down={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
]
}
running={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
Expand Down Expand Up @@ -150,85 +182,6 @@ sokoban_skip={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
]
}
move_up={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":true,"script":null)
]
}
move_right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":true,"script":null)
]
}
move_down={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":true,"script":null)
]
}
move_left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":true,"script":null)
]
}
aim_up={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
]
}
aim_right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
]
}
aim_down={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
]
}
aim_left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
]
}
interact={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
]
}
repel={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
]
}
throw={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(92, 25),"global_position":Vector2(92, 54),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}

[layer_names]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ class_name DirectionalInput
extends Node

@export_group("Action Bindings")
@export var action_up: StringName = "move_up"
@export var action_down: StringName = "move_down"
@export var action_left: StringName = "move_left"
@export var action_right: StringName = "move_right"
@export var action_up: StringName = "ui_up"
@export var action_down: StringName = "ui_down"
@export var action_left: StringName = "ui_left"
@export var action_right: StringName = "ui_right"

@export_group("Behavior")
## If true, will alternate between diagonals when held. Else, will repeat the most recent direction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func _ready() -> void:


func _unhandled_input(_event: InputEvent) -> void:
var axis: Vector2 = Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down")
var axis: Vector2 = Input.get_vector(&"ui_left", &"ui_right", &"ui_up", &"ui_down")

var speed: float
if player_hook.is_throwing_or_aiming():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ func _ready() -> void:


func _unhandled_input(_event: InputEvent) -> void:
if Input.is_action_just_pressed(&"repel"):
if Input.is_action_just_pressed(&"ui_accept"):
is_fighting = true
elif Input.is_action_just_released(&"repel"):
elif Input.is_action_just_released(&"ui_accept"):
is_fighting = false


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func _unhandled_input(_event: InputEvent) -> void:
return

var interact_area: InteractArea = interact_zone.get_interact_area()
if interact_area and Input.is_action_just_pressed(&"interact"):
if interact_area and Input.is_action_just_pressed(&"ui_accept"):
get_viewport().set_input_as_handled()
interact_zone.monitoring = false
interact_label.visible = false
Expand Down
1 change: 1 addition & 0 deletions scenes/game_elements/props/decoration/crops/barley.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[ext_resource type="Script" uid="uid://cms2wqtbxjl1h" path="res://scenes/game_elements/props/decoration/random_frame_animated_sprite.gd" id="3_3fedp"]

[node name="Barley" type="Node2D"]
scale = Vector2(0.5, 0.5)
script = ExtResource("1_ili7e")
sprite_frames = ExtResource("2_3fedp")

Expand Down
1 change: 1 addition & 0 deletions scenes/game_elements/props/decoration/crops/tomato.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[ext_resource type="Script" uid="uid://cms2wqtbxjl1h" path="res://scenes/game_elements/props/decoration/random_frame_animated_sprite.gd" id="3_bta8g"]

[node name="Tomato" type="Node2D"]
scale = Vector2(0.5, 0.5)
script = ExtResource("1_8cueo")
sprite_frames = ExtResource("2_bta8g")

Expand Down
8 changes: 4 additions & 4 deletions scenes/game_elements/props/hint/input_key/gamepad_input.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ func _physics_process(_delta: float) -> void:
if is_controller_main_display:
var is_pressed := Input.is_action_pressed(action_name)
var any_direction_pressed := (
Input.is_action_pressed("move_up")
or Input.is_action_pressed("move_down")
or Input.is_action_pressed("move_left")
or Input.is_action_pressed("move_right")
Input.is_action_pressed("ui_up")
or Input.is_action_pressed("ui_down")
or Input.is_action_pressed("ui_left")
or Input.is_action_pressed("ui_right")
)

if is_pressed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ extends Node2D
## Handles the input to control the aiming and throwing.
## This is a piece of the grappling hook mechanic.
## [br][br]
## The [b]throw[/b] action is used for throwing.
## The [b]ui_accept[/b] action is used for throwing.
## [br][br]
## The [b]aim_up, aim_down, aim_left and aim_right[/b] actions are used for aiming.
## The [b]ui_up, ui_down, ui_left and ui_right[/b] actions are used for aiming.
## Additionally, the mouse movement can also be used for aiming,
## but the mouse not considered the primary input.
## [br][br]
Expand Down Expand Up @@ -83,51 +83,30 @@ var _hook_angle: float
## The ray cast to handle collisions with hookable areas.
@onready var ray_cast_2d: RayCast2D = %RayCast2D

## Timer to let a directional pad continue aiming in
## diagonal directions when releasing the input actions.
@onready var d_pad_timer: Timer = %DPadTimer


func _unhandled_input(_event: InputEvent) -> void:
var axis: Vector2

if _event is InputEventMouseMotion:
var axis := get_global_mouse_position() - global_position
axis = get_global_mouse_position() - global_position
if not axis.is_zero_approx():
_hook_angle = axis.angle()
_hook_angle_set = true
return

# When aiming with keyboard, do not change the hook angle immediately if one of these actions
# was released. This makes it possible to aim in diagonal directions.
# When aiming with keyboard, do not change the hook angle if one of these actions was released.
# This makes it possible to aim in diagonal directions.
# Otherwise, if for example left and down are pressed to aim in diagonal and both are released,
# there is always one that is released first so the aim direction ends up being either left or
# down, not left AND down.
if (
_event is InputEventKey
and (
_event.is_action_released(&"aim_left")
or _event.is_action_released(&"aim_right")
or _event.is_action_released(&"aim_up")
or _event.is_action_released(&"aim_down")
)
_event.is_action_released(&"ui_left")
or _event.is_action_released(&"ui_right")
or _event.is_action_released(&"ui_up")
or _event.is_action_released(&"ui_down")
):
d_pad_timer.start()
return

_update_hook_angle()

if Input.is_action_just_pressed(&"throw"):
pressing_throw_action = true
return

if Input.is_action_just_released(&"throw"):
pressing_throw_action = false
throw_failed_while_pressing = false
return


func _update_hook_angle() -> void:
var axis: Vector2
axis = Input.get_vector(&"aim_left", &"aim_right", &"aim_up", &"aim_down")
axis = Input.get_vector(&"ui_left", &"ui_right", &"ui_up", &"ui_down")
if not axis.is_zero_approx():
if pressing_throw_action:
_hook_angle = rotate_toward(_hook_angle, axis.angle(), 0.05)
Expand All @@ -136,6 +115,15 @@ func _update_hook_angle() -> void:
_hook_angle = axis.angle()
_hook_angle_set = true

if Input.is_action_just_pressed(&"ui_accept"):
pressing_throw_action = true
return

if Input.is_action_just_released(&"ui_accept"):
pressing_throw_action = false
throw_failed_while_pressing = false
return


func _get_hook_angle() -> float:
return _hook_angle if _hook_angle_set else initial_hook_angle
Expand Down Expand Up @@ -216,7 +204,3 @@ func _process(_delta: float) -> void:
return
if state != State.AIMING_PAUSED and pressing_throw_action and not throw_failed_while_pressing:
_throw()


func _on_d_pad_timer_timeout() -> void:
_update_hook_angle()
7 changes: 0 additions & 7 deletions scenes/game_elements/props/hook_control/hook_control.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,3 @@ unique_name_in_owner = true
target_position = Vector2(300, 0)
collision_mask = 4112
collide_with_areas = true

[node name="DPadTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 0.2
one_shot = true

[connection signal="timeout" from="DPadTimer" to="." method="_on_d_pad_timer_timeout"]
Loading