diff --git a/scenes/player.tscn b/scenes/player.tscn index d3bdfa5..5104e00 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -104,7 +104,7 @@ autoplay = "fwd" [node name="MuzzleFlash" type="AnimatedSprite2D" parent="Ship" unique_id=1584132038] unique_name_in_owner = true -position = Vector2(0, -16) +position = Vector2(0.5, -16) sprite_frames = SubResource("SpriteFrames_3v2ag") animation = &"stock" autoplay = "stock" diff --git a/scripts/player.gd b/scripts/player.gd index c3a4b34..858b4d5 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -23,6 +23,7 @@ var weapon_spacing: float = 0.1 @onready var screensize = get_viewport_rect().size @onready var muzzle_damage = %MuzzleBox + func _process(delta): var input = Input.get_vector("left", "right", "up","down") @@ -63,7 +64,6 @@ func _process(delta): is_shooting = false if is_shooting == true: - print("Spacebar pressed!") %MuzzleFlash.show() %Ship/MuzzleFlash.animation = "stock" @@ -87,13 +87,15 @@ func _on_weapon_cooldown_timeout() -> void: func shoot(): - var projectiles: int = 2 + var projectiles: int = 3 + const PROJECTILE_SPACING: float = 10 + const MUZZLE_HEIGHT: int = -23 for b in projectiles: # Instantiate the bullets var bullet = weapon_current.instantiate() get_tree().root.add_child(bullet) - bullet.position = position + Vector2((b * 10) - (projectiles * projectiles),-23) + bullet.position = position + Vector2((b * PROJECTILE_SPACING) - (projectiles * projectiles), MUZZLE_HEIGHT) # Get weapon speed and spacing for equidistant calculations weapon_rate = bullet.shot_data.rate diff --git a/scripts/player_shot.gd b/scripts/player_shot.gd index 9455240..1f433f3 100644 --- a/scripts/player_shot.gd +++ b/scripts/player_shot.gd @@ -1,11 +1,14 @@ 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 rate: float = 0.1 @export var cooldown: float = 0.25 -@export var sprite: Texture2D = preload("res://graphics/shot.png") @export var spacing: float = 35