Modified weapon scripts and resources with a simplified spread angle
variable.
This commit is contained in:
parent
4f90c82b8f
commit
4f3839448b
7 changed files with 75 additions and 3 deletions
|
|
@ -13,6 +13,7 @@
|
|||
[ext_resource type="Script" uid="uid://7n1itonn35fm" path="res://scripts/weapon_shot.gd" id="10_d2wvv"]
|
||||
[ext_resource type="Resource" uid="uid://cck3gmnhu5agc" path="res://resources/player_weapon_resources/tri.tres" id="11_3v2ag"]
|
||||
[ext_resource type="Script" uid="uid://65d3hbrpm21x" path="res://scripts/effects/effects_component.gd" id="12_effcomp"]
|
||||
[ext_resource type="Resource" uid="uid://ds53sryglmf27" path="res://resources/player_weapon_resources/spread.tres" id="13_f1ej7"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
|
||||
atlas = ExtResource("5_qlg0r")
|
||||
|
|
@ -157,7 +158,7 @@ script = ExtResource("6_y4r1p")
|
|||
unique_name_in_owner = true
|
||||
script = ExtResource("7_d2wvv")
|
||||
weapon_data = ExtResource("8_stock")
|
||||
available_weapons = Array[ExtResource("10_d2wvv")]([ExtResource("8_stock"), ExtResource("11_3v2ag"), ExtResource("9_ur7pv")])
|
||||
available_weapons = Array[ExtResource("10_d2wvv")]([ExtResource("8_stock"), ExtResource("11_3v2ag"), ExtResource("9_ur7pv"), ExtResource("13_f1ej7")])
|
||||
weapon_change_flash = SubResource("Resource_jej6c")
|
||||
metadata/_custom_type_script = "uid://ylmao2ndp22y"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ var time_offset: float = 0.5
|
|||
# When this bullet should fire (absolute time)
|
||||
var fire_time: float = 0.0
|
||||
|
||||
# Angle offset for spread shots (in degrees)
|
||||
var angle: float = 0.0
|
||||
|
||||
# Track if this bullet is currently active in the shot
|
||||
var is_active: bool = false
|
||||
|
||||
|
|
@ -20,8 +23,9 @@ func _process(delta):
|
|||
if !is_active and current_time >= fire_time:
|
||||
activate()
|
||||
|
||||
# Move the bullet
|
||||
position.y -= shot_data.speed * delta
|
||||
# Move the bullet, factoring in spread angle
|
||||
var velocity = Vector2.UP.rotated(deg_to_rad(angle)) * shot_data.speed
|
||||
position += velocity * delta
|
||||
|
||||
func activate():
|
||||
is_active = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue