2025-12-06 20:28:33 +00:00
|
|
|
extends "res://scripts/character_ground.gd"
|
2025-12-02 22:04:12 +00:00
|
|
|
|
2025-12-07 00:33:42 +00:00
|
|
|
var last_aim_direction = Vector2(0, 0)
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
super()
|
|
|
|
|
|
2025-12-07 06:34:20 +00:00
|
|
|
if global.stats.gun_holstered:
|
|
|
|
|
set_ground_gun(null)
|
|
|
|
|
else:
|
|
|
|
|
set_ground_gun(global.stats.equipped_ground_gun)
|
2025-12-07 00:33:42 +00:00
|
|
|
|
2025-12-02 19:51:40 +00:00
|
|
|
func _process(delta: float) -> void:
|
2025-12-06 20:28:33 +00:00
|
|
|
super(delta)
|
2025-12-02 19:51:40 +00:00
|
|
|
|
2025-12-07 06:34:20 +00:00
|
|
|
if dead:
|
|
|
|
|
if global.checkpoint:
|
|
|
|
|
global.load_game()
|
|
|
|
|
get_tree().change_scene_to_file("res://scenes/ground.tscn")
|
|
|
|
|
|
2025-12-07 00:33:42 +00:00
|
|
|
if input_icon.using_gamepad:
|
|
|
|
|
if !((Input.get_axis("aim_left", "aim_right") == 0) and (Input.get_axis("aim_up", "aim_down") == 0)):
|
|
|
|
|
$HeldItem.rotation = Vector2(
|
|
|
|
|
Input.get_axis("aim_left", "aim_right"),
|
|
|
|
|
Input.get_axis("aim_up", "aim_down")
|
|
|
|
|
).angle()
|
|
|
|
|
|
|
|
|
|
if ($HeldItem.rotation_degrees < -90) or ($HeldItem.rotation_degrees > 90):
|
|
|
|
|
$HeldItem/Sprite.scale.y = -1
|
|
|
|
|
else:
|
|
|
|
|
$HeldItem/Sprite.scale.y = 1
|
|
|
|
|
else:
|
|
|
|
|
$HeldItem.look_at(get_global_mouse_position())
|
|
|
|
|
|
2025-12-06 20:28:33 +00:00
|
|
|
horizontial_movement = Input.get_axis("ground_left", "ground_right")
|
|
|
|
|
vertical_movement = Input.get_axis("ground_up", "ground_down")
|
2025-12-07 00:33:42 +00:00
|
|
|
|
2025-12-07 01:48:11 +00:00
|
|
|
if $HeldItem/Cast.get_collision_point():
|
|
|
|
|
$HeldItem/Crosshair.visible = true
|
|
|
|
|
$HeldItem/Line.visible = true
|
|
|
|
|
|
|
|
|
|
$HeldItem/Crosshair.global_position = $HeldItem/Cast.get_collision_point()
|
|
|
|
|
$HeldItem/Line.points[1].x = ($HeldItem/Cast.get_collision_point() - global_position).length()
|
|
|
|
|
else:
|
|
|
|
|
$HeldItem/Crosshair.visible = false
|
|
|
|
|
$HeldItem/Line.visible = false
|
2025-12-07 06:34:20 +00:00
|
|
|
|
|
|
|
|
if Input.is_action_just_pressed("toggle_holster"):
|
2025-12-07 18:36:35 +00:00
|
|
|
if global.stats.equipped_ground_gun:
|
|
|
|
|
global.stats.gun_holstered = !global.stats.gun_holstered
|
|
|
|
|
|
|
|
|
|
if global.stats.gun_holstered:
|
|
|
|
|
set_ground_gun(null)
|
|
|
|
|
else:
|
|
|
|
|
set_ground_gun(global.stats.equipped_ground_gun)
|
2025-12-07 06:34:20 +00:00
|
|
|
else:
|
2025-12-07 18:36:35 +00:00
|
|
|
global.stats.gun_holstered = true
|
|
|
|
|
|
|
|
|
|
set_ground_gun(null)
|
2025-12-07 06:34:20 +00:00
|
|
|
|
2025-12-07 01:48:11 +00:00
|
|
|
|
2025-12-07 00:33:42 +00:00
|
|
|
firing = Input.is_action_pressed("fire")
|