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
|
|
@ -20,7 +20,7 @@ var ship_displacement: float
|
|||
var travel: float = 0
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
|
||||
## Set initial start position
|
||||
position = Vector2(screensize.x / 2, screensize.y - 45)
|
||||
|
||||
|
|
@ -37,12 +37,16 @@ func _process(delta) -> void:
|
|||
if is_shooting == true:
|
||||
shoot_component.shoot()
|
||||
$%MuzzleFlash.show()
|
||||
|
||||
|
||||
if is_shooting == false:
|
||||
$%MuzzleFlash.hide()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Read Movement Component
|
||||
movement_component.input = input_component.move_dir
|
||||
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://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="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"]
|
||||
atlas = ExtResource("5_qlg0r")
|
||||
|
|
@ -34,7 +37,7 @@ animations = [{
|
|||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_fjrip")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": 1,
|
||||
"name": &"banked",
|
||||
"speed": 15.0
|
||||
}, {
|
||||
|
|
@ -45,7 +48,7 @@ animations = [{
|
|||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ur7pv")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": 1,
|
||||
"name": &"fwd",
|
||||
"speed": 15.0
|
||||
}]
|
||||
|
|
@ -74,7 +77,7 @@ animations = [{
|
|||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d2wvv")
|
||||
}],
|
||||
"loop": true,
|
||||
"loop": 1,
|
||||
"name": &"stock",
|
||||
"speed": 15.0
|
||||
}]
|
||||
|
|
@ -90,9 +93,6 @@ size = Vector2(6, 5.75)
|
|||
|
||||
[node name="Player" type="Area2D" unique_id=652131079]
|
||||
script = ExtResource("1_ur7pv")
|
||||
can_shoot = null
|
||||
is_shooting = null
|
||||
muzzle_flash = null
|
||||
|
||||
[node name="Ship" type="Sprite2D" parent="." unique_id=1155866924]
|
||||
unique_name_in_owner = true
|
||||
|
|
@ -148,11 +148,12 @@ metadata/_custom_type_script = "uid://c0rikbakpcags"
|
|||
[node name="ShootComponent" type="Node" parent="." unique_id=623642425]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("6_y4r1p")
|
||||
metadata/_custom_type_script = "uid://bgd1hwindc2ui"
|
||||
|
||||
[node name="WeaponComponent" type="Node" parent="." unique_id=1648685183]
|
||||
unique_name_in_owner = true
|
||||
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"
|
||||
|
||||
[connection signal="timeout" from="WeaponCooldown" to="." method="_on_weapon_cooldown_timeout"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue