Updated input component and player component handling to use tab to
cycle weapons.
This commit is contained in:
parent
e2cf516c90
commit
63ed0aae3a
4 changed files with 24 additions and 15 deletions
|
|
@ -12,7 +12,7 @@ config_version=5
|
||||||
|
|
||||||
config/name="Facsimile Wing"
|
config/name="Facsimile Wing"
|
||||||
run/main_scene="uid://bj4fytc3sy482"
|
run/main_scene="uid://bj4fytc3sy482"
|
||||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
config/features=PackedStringArray("4.7", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
@ -52,6 +52,11 @@ shoot={
|
||||||
"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)
|
"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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
cycle={
|
||||||
|
"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":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,3 +46,7 @@ func _process(delta) -> void:
|
||||||
# Read Movement Component
|
# Read Movement Component
|
||||||
movement_component.input = input_component.move_dir
|
movement_component.input = input_component.move_dir
|
||||||
movement_component.tick(delta)
|
movement_component.tick(delta)
|
||||||
|
|
||||||
|
# Cycle weapon (testing key)
|
||||||
|
if input_component.cycle_weapon:
|
||||||
|
weapon_component.cycle_weapon()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
[ext_resource type="Script" uid="uid://c0rikbakpcags" path="res://scripts/movement_component.gd" id="5_ur7pv"]
|
[ext_resource type="Script" uid="uid://c0rikbakpcags" path="res://scripts/movement_component.gd" id="5_ur7pv"]
|
||||||
[ext_resource type="Script" uid="uid://suynuijl68qp" path="res://scripts/shoot_component.gd" id="6_y4r1p"]
|
[ext_resource type="Script" uid="uid://suynuijl68qp" path="res://scripts/shoot_component.gd" id="6_y4r1p"]
|
||||||
[ext_resource type="Script" uid="uid://ylmao2ndp22y" path="res://scripts/weapon_component.gd" id="7_d2wvv"]
|
[ext_resource type="Script" uid="uid://ylmao2ndp22y" path="res://scripts/weapon_component.gd" id="7_d2wvv"]
|
||||||
|
[ext_resource type="Resource" uid="uid://b75ae840k03dy" path="res://resources/player_weapon_resources/weapon_shot_stock.tres" id="8_stock"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bhc6aja38vyr" path="res://resources/player_weapon_resources/weapon_shot_spread.tres" id="9_ur7pv"]
|
||||||
|
[ext_resource type="Script" uid="uid://7n1itonn35fm" path="res://resources/player_weapon_resources/weapon_shot.gd" id="10_d2wvv"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
|
||||||
atlas = ExtResource("5_qlg0r")
|
atlas = ExtResource("5_qlg0r")
|
||||||
|
|
@ -34,7 +37,7 @@ animations = [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_fjrip")
|
"texture": SubResource("AtlasTexture_fjrip")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": 1,
|
||||||
"name": &"banked",
|
"name": &"banked",
|
||||||
"speed": 15.0
|
"speed": 15.0
|
||||||
}, {
|
}, {
|
||||||
|
|
@ -45,7 +48,7 @@ animations = [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_ur7pv")
|
"texture": SubResource("AtlasTexture_ur7pv")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": 1,
|
||||||
"name": &"fwd",
|
"name": &"fwd",
|
||||||
"speed": 15.0
|
"speed": 15.0
|
||||||
}]
|
}]
|
||||||
|
|
@ -74,7 +77,7 @@ animations = [{
|
||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_d2wvv")
|
"texture": SubResource("AtlasTexture_d2wvv")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": 1,
|
||||||
"name": &"stock",
|
"name": &"stock",
|
||||||
"speed": 15.0
|
"speed": 15.0
|
||||||
}]
|
}]
|
||||||
|
|
@ -90,9 +93,6 @@ size = Vector2(6, 5.75)
|
||||||
|
|
||||||
[node name="Player" type="Area2D" unique_id=652131079]
|
[node name="Player" type="Area2D" unique_id=652131079]
|
||||||
script = ExtResource("1_ur7pv")
|
script = ExtResource("1_ur7pv")
|
||||||
can_shoot = null
|
|
||||||
is_shooting = null
|
|
||||||
muzzle_flash = null
|
|
||||||
|
|
||||||
[node name="Ship" type="Sprite2D" parent="." unique_id=1155866924]
|
[node name="Ship" type="Sprite2D" parent="." unique_id=1155866924]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
@ -148,11 +148,12 @@ metadata/_custom_type_script = "uid://c0rikbakpcags"
|
||||||
[node name="ShootComponent" type="Node" parent="." unique_id=623642425]
|
[node name="ShootComponent" type="Node" parent="." unique_id=623642425]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("6_y4r1p")
|
script = ExtResource("6_y4r1p")
|
||||||
metadata/_custom_type_script = "uid://bgd1hwindc2ui"
|
|
||||||
|
|
||||||
[node name="WeaponComponent" type="Node" parent="." unique_id=1648685183]
|
[node name="WeaponComponent" type="Node" parent="." unique_id=1648685183]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("7_d2wvv")
|
script = ExtResource("7_d2wvv")
|
||||||
|
weapon_data = ExtResource("9_ur7pv")
|
||||||
|
available_weapons = Array[ExtResource("10_d2wvv")]([ExtResource("8_stock"), ExtResource("9_ur7pv")])
|
||||||
metadata/_custom_type_script = "uid://ylmao2ndp22y"
|
metadata/_custom_type_script = "uid://ylmao2ndp22y"
|
||||||
|
|
||||||
[connection signal="timeout" from="WeaponCooldown" to="." method="_on_weapon_cooldown_timeout"]
|
[connection signal="timeout" from="WeaponCooldown" to="." method="_on_weapon_cooldown_timeout"]
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,12 @@ class_name InputComponent extends Node
|
||||||
var move_dir: Vector2 = Vector2.ZERO
|
var move_dir: Vector2 = Vector2.ZERO
|
||||||
var shoot_pressed: bool = false
|
var shoot_pressed: bool = false
|
||||||
var shooting: bool = false
|
var shooting: bool = false
|
||||||
|
var cycle_weapon: bool = false
|
||||||
|
|
||||||
func update() -> void:
|
func update() -> void:
|
||||||
move_dir = Input.get_vector("left", "right", "up", "down")
|
move_dir = Input.get_vector("left", "right", "up", "down")
|
||||||
shoot_pressed = Input.is_action_just_pressed("shoot")
|
shoot_pressed = Input.is_action_just_pressed("shoot")
|
||||||
shooting = Input.is_action_pressed("shoot")
|
shooting = Input.is_action_pressed("shoot")
|
||||||
|
|
||||||
|
|
||||||
# Development Keys
|
# Development Keys
|
||||||
# Cycle Available Weapons
|
cycle_weapon = Input.is_action_just_pressed("cycle")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue