Added bullet indexing to create shot patterns
This commit is contained in:
parent
bdbc3b015f
commit
1725b8b754
13 changed files with 91 additions and 27 deletions
|
|
@ -6,15 +6,23 @@ class_name Player extends Area2D
|
|||
@onready var shoot_component: ShootComponent = %ShootComponent
|
||||
@onready var weapon_component: WeaponComponent = %WeaponComponent
|
||||
|
||||
# Get the viewport size for positioning
|
||||
@onready var screensize = get_viewport().content_scale_size
|
||||
|
||||
# Variables for Player shooting status
|
||||
@export var can_shoot: bool = true
|
||||
@export var is_shooting: bool = false
|
||||
@export var muzzle_flash: bool = false
|
||||
|
||||
# Variables for Player position calculations for equidistant bullets
|
||||
var previous_position: Vector2
|
||||
var ship_displacement: float
|
||||
var travel: float = 0
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
## Set initial start position
|
||||
position = Vector2(screensize.x / 2, screensize.y - 45)
|
||||
|
||||
func _process(delta) -> void:
|
||||
|
||||
|
|
@ -28,6 +36,12 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue