Beginning to update weapon components
This commit is contained in:
parent
db57a0234e
commit
e3fb082139
11 changed files with 66 additions and 37 deletions
|
|
@ -11,6 +11,7 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="Facsimile Wing"
|
||||
run/main_scene="uid://coix5dqblmu7r"
|
||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
[resource]
|
||||
script = ExtResource("1_t07sl")
|
||||
shot_name = "Stock"
|
||||
speed = 375
|
||||
projectiles = 4
|
||||
speed = 500
|
||||
spacing = 28.0
|
||||
metadata/_custom_type_script = "uid://ccdohs4gduee5"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,5 @@
|
|||
[resource]
|
||||
script = ExtResource("1_reevt")
|
||||
shot_name = "Stock"
|
||||
speed = -350
|
||||
cooldown = 0.0
|
||||
projectile_spacing = 10.0
|
||||
speed = 500
|
||||
metadata/_custom_type_script = "uid://ccdohs4gduee5"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ extends Area2D
|
|||
|
||||
|
||||
func _process(delta):
|
||||
position.y -= shot_data.speed * delta # This works normally
|
||||
|
||||
#Calculation position along Y axis
|
||||
position.y -= shot_data.speed * delta
|
||||
|
||||
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
|
||||
queue_free()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ func tick(delta: float):
|
|||
# Check to see if there's a player to move
|
||||
if player == null: return
|
||||
|
||||
# Shorten variable for accessing weapon_component for clarity
|
||||
var weapon_system = weapon_component.data
|
||||
|
||||
# Calculate ship to bullet displacement
|
||||
player.ship_displacement = player.position.y - player.previous_position.y
|
||||
player.travel += abs(weapon_system.speed) * delta + (player.ship_displacement)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class_name PlayerShot
|
||||
class_name PlayerShotResource
|
||||
extends Resource
|
||||
|
||||
@export_category("Info")
|
||||
|
|
@ -11,5 +11,3 @@ extends Resource
|
|||
@export var projectiles: int = 2
|
||||
@export var spacing: float = 35
|
||||
@export var origin: int = -23
|
||||
#@export var rate: float = 0.1
|
||||
#@export var cooldown: float = 0.25
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@ class_name ShootComponent extends Node
|
|||
@onready var weapon_component: Node = %WeaponComponent
|
||||
@onready var player: Player = $".."
|
||||
|
||||
#var travel: float = 0
|
||||
#var weapon_spacing: float = 0.1
|
||||
|
||||
|
||||
func shoot():
|
||||
|
||||
# Shorten variable for accessing weapon_component for clarity
|
||||
var weapon_system = weapon_component.data
|
||||
|
||||
if player.travel > weapon_system.spacing:
|
||||
print("Travel is greater!")
|
||||
|
||||
for b in range(weapon_system.projectiles):
|
||||
|
||||
# Instantiate the bullets
|
||||
|
|
@ -22,10 +19,6 @@ func shoot():
|
|||
|
||||
bullet.position = player.position + Vector2((b - (weapon_system.projectiles - 1) / 2.0) * round(round((weapon_system.projectiles + weapon_system.spacing / 2)) / 2), weapon_system.origin)
|
||||
print(b, bullet.position.x)
|
||||
## Get weapon speed and spacing for equidistant calculations - non comp
|
||||
#weapon_rate = bullet.weapon_component.bullet_data.rate
|
||||
#weapon_component.bullet_data.projectile_spacing = bullet.weapon_component.bullet_data.projectile_spacing
|
||||
#weapon_component.bullet_data.speed = bullet.weapon_component.bullet_data.speed
|
||||
|
||||
# Print which weapon is firing
|
||||
prints(bullet.shot_data.shot_name, "weapon fired")
|
||||
|
|
|
|||
21
scripts/weapon_component_original.gd
Normal file
21
scripts/weapon_component_original.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class_name WeaponComponent extends Node
|
||||
|
||||
@export var weapon_current : PackedScene
|
||||
var data: PlayerShot = load("res://resources/player_weapons/shot_stock.tres")
|
||||
#@export var projectile_origin: int = -23
|
||||
|
||||
#@export_category("Temp Bullet Data")
|
||||
#@export var projectiles: int = 3
|
||||
#@export var projectile_spacing: float = 10
|
||||
|
||||
#var damage: int = 0
|
||||
#var speed: int = 135
|
||||
#var projectiles: int = 2
|
||||
#var rate: float = 0.1
|
||||
#var cooldown: float = 0.25
|
||||
#var projectile_spacing: float = 10
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
scripts/weapon_component_original.gd.uid
Normal file
1
scripts/weapon_component_original.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cy50u6ksjqvjc
|
||||
13
scripts/weapon_shot.gd
Normal file
13
scripts/weapon_shot.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class_name PlayerShot
|
||||
extends Resource
|
||||
|
||||
@export_category("Info")
|
||||
@export var shot_name: String
|
||||
@export var sprite: Texture2D = preload("res://graphics/shot.png")
|
||||
|
||||
@export_category("Shot Data")
|
||||
@export var damage: int = 1
|
||||
@export var speed: int = 135
|
||||
@export var projectiles: int = 2
|
||||
@export var spacing: float = 35
|
||||
@export var origin: int = -23
|
||||
1
scripts/weapon_shot.gd.uid
Normal file
1
scripts/weapon_shot.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://7n1itonn35fm
|
||||
Loading…
Add table
Add a link
Reference in a new issue