Trying to rework cannon, gatling, launcher
This commit is contained in:
@@ -7,57 +7,15 @@ extends AbstractWeapon
|
||||
@onready var right_particles : GPUParticles2D = $ShotParticles/Right
|
||||
@onready var shell_particles : GPUParticles2D = $ShellParticles
|
||||
@onready var cooldown_timer : Timer = $CooldownTimer
|
||||
@onready var muzzle : Node2D = $Muzzle
|
||||
|
||||
|
||||
func set_belonging(belonging: Belonging) -> void:
|
||||
super.set_belonging(belonging)
|
||||
|
||||
_init_particles()
|
||||
|
||||
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
|
||||
|
||||
|
||||
func _init_particles() -> void:
|
||||
const FRONT_OFFSET_X = 12
|
||||
const SIDE_OFFSET_X = 6
|
||||
const SIDE_OFFSET_Y = 5
|
||||
const SHELL_OFFSET_X = -10
|
||||
const SHELL_OFFSET_Y = 2
|
||||
|
||||
|
||||
match _belonging:
|
||||
Belonging.PLAYER:
|
||||
front_particles.process_material.emission_shape_offset.x = FRONT_OFFSET_X
|
||||
front_particles.process_material.direction = Vector3.RIGHT
|
||||
|
||||
left_particles.process_material.emission_shape_offset.x = SIDE_OFFSET_X
|
||||
left_particles.process_material.emission_shape_offset.y = -SIDE_OFFSET_Y
|
||||
left_particles.process_material.direction = Vector3.DOWN + Vector3.LEFT
|
||||
|
||||
right_particles.process_material.emission_shape_offset.x = SIDE_OFFSET_X
|
||||
right_particles.process_material.emission_shape_offset.y = SIDE_OFFSET_Y
|
||||
right_particles.process_material.direction = Vector3.UP + Vector3.LEFT
|
||||
|
||||
shell_particles.process_material.emission_shape_offset.x = SHELL_OFFSET_X
|
||||
shell_particles.process_material.emission_shape_offset.y = SHELL_OFFSET_Y
|
||||
shell_particles.process_material.direction = Vector3.UP
|
||||
Belonging.ENEMY:
|
||||
front_particles.process_material.emission_shape_offset.x = -FRONT_OFFSET_X
|
||||
front_particles.process_material.direction = Vector3.LEFT
|
||||
|
||||
left_particles.process_material.emission_shape_offset.x = -SIDE_OFFSET_X
|
||||
left_particles.process_material.emission_shape_offset.y = -SIDE_OFFSET_Y
|
||||
left_particles.process_material.direction = Vector3.DOWN + Vector3.RIGHT
|
||||
|
||||
right_particles.process_material.emission_shape_offset.x = -SIDE_OFFSET_X
|
||||
right_particles.process_material.emission_shape_offset.y = SIDE_OFFSET_Y
|
||||
right_particles.process_material.direction = Vector3.UP + Vector3.RIGHT
|
||||
|
||||
shell_particles.process_material.emission_shape_offset.x = -SHELL_OFFSET_X
|
||||
shell_particles.process_material.emission_shape_offset.y = -SHELL_OFFSET_Y
|
||||
shell_particles.process_material.direction = Vector3.DOWN
|
||||
|
||||
|
||||
func shoot(ship_velocity: Vector2) -> bool:
|
||||
var is_shot := super.shoot(ship_velocity)
|
||||
if is_shot:
|
||||
@@ -69,6 +27,10 @@ func shoot(ship_velocity: Vector2) -> bool:
|
||||
return is_shot
|
||||
|
||||
|
||||
func _get_projectile_position() -> Vector2:
|
||||
return muzzle.position
|
||||
|
||||
|
||||
func _restart_particles() -> void:
|
||||
front_particles.restart()
|
||||
left_particles.restart()
|
||||
|
||||
Reference in New Issue
Block a user