diff --git a/scenes/bullets/star_wrath/glowing_circle.png b/scenes/bullets/star_wrath/glowing_circle.png new file mode 100644 index 0000000..6e51f4f Binary files /dev/null and b/scenes/bullets/star_wrath/glowing_circle.png differ diff --git a/scenes/bullets/star_wrath/glowing_circle.png.import b/scenes/bullets/star_wrath/glowing_circle.png.import new file mode 100644 index 0000000..f3581aa --- /dev/null +++ b/scenes/bullets/star_wrath/glowing_circle.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ddf8ome85torc" +path="res://.godot/imported/glowing_circle.png-4c026c6aea7f4278a8e69a98fe54edcb.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/bullets/star_wrath/glowing_circle.png" +dest_files=["res://.godot/imported/glowing_circle.png-4c026c6aea7f4278a8e69a98fe54edcb.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/scenes/bullets/star_wrath/laser_beam.gd b/scenes/bullets/star_wrath/laser_beam.gd new file mode 100644 index 0000000..9b84309 --- /dev/null +++ b/scenes/bullets/star_wrath/laser_beam.gd @@ -0,0 +1,68 @@ +extends RayCast2D + +@export var cast_speed = 7000.0 +@export var max_length = 1400.0 +@export var growth_time = 0.5 + +var is_casting = false +var tween +@onready var fill = $Line2D +@onready var casting_particles = $CastingParticles +@onready var collision_particles = $CollisionParticles +@onready var beam_particles = $BeamParticles +@onready var line_width = fill.width + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + set_physics_process(false) + fill.points[1] = Vector2.ZERO + tween = create_tween() + + +func _physics_process(delta: float) -> void: + target_position = (target_position + Vector2.RIGHT * cast_speed * delta).limit_length( + max_length + ) + cast_beam() + + +func cast_beam(): + var cast_point = target_position + force_raycast_update() + var status = is_colliding() + collision_particles.emitting = status + if status: + cast_point = to_local(get_collision_point()) + collision_particles.global_rotation = get_collision_normal().angle() + collision_particles.global_position = get_collision_point() + fill.points[1] = cast_point + beam_particles.position = cast_point * 0.5 + beam_particles.process_material.emission_box_extents.x = cast_point.length() * 0.5 + + +func set_is_casting(cast: bool) -> void: + is_casting = cast + if is_casting: + target_position = Vector2.ZERO + fill.points[1] = target_position + appear() + else: + fill.points[1] = Vector2.ZERO + collision_particles.emitting = false + disappear() + set_physics_process(is_casting) + beam_particles.emitting = is_casting + casting_particles.emitting = is_casting + + +func appear(): + tween.kill() + tween = create_tween() + tween.tween_property(fill, "width", line_width, growth_time * 2).from(0) + + +func disappear(): + tween.kill() + tween = create_tween() + tween.tween_property(fill, "width", 0, growth_time).from(line_width) diff --git a/scenes/bullets/star_wrath/laser_beam.tscn b/scenes/bullets/star_wrath/laser_beam.tscn new file mode 100644 index 0000000..829eb20 --- /dev/null +++ b/scenes/bullets/star_wrath/laser_beam.tscn @@ -0,0 +1,31 @@ +[gd_scene load_steps=5 format=3 uid="uid://cx8edyix2wwjs"] + +[ext_resource type="Script" path="res://scenes/bullets/star_wrath/laser_beam.gd" id="1_pxjff"] + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_ksbrs"] +particle_flag_disable_z = true +gravity = Vector3(0, 98, 0) + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_nsxxn"] +particle_flag_disable_z = true +gravity = Vector3(0, 98, 0) + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_025qw"] +particle_flag_disable_z = true +gravity = Vector3(0, 98, 0) + +[node name="LaserBeam" type="RayCast2D"] +script = ExtResource("1_pxjff") + +[node name="Line2D" type="Line2D" parent="."] +points = PackedVector2Array(0, 0, 100, 0) +closed = true + +[node name="CastingParticles" type="GPUParticles2D" parent="."] +process_material = SubResource("ParticleProcessMaterial_ksbrs") + +[node name="BeamParticles" type="GPUParticles2D" parent="."] +process_material = SubResource("ParticleProcessMaterial_nsxxn") + +[node name="CollisionParticles" type="GPUParticles2D" parent="."] +process_material = SubResource("ParticleProcessMaterial_025qw") diff --git a/scenes/weapons/star_wrath/star_wrath.gd b/scenes/weapons/star_wrath/star_wrath.gd index 47569f8..eb468d9 100644 --- a/scenes/weapons/star_wrath/star_wrath.gd +++ b/scenes/weapons/star_wrath/star_wrath.gd @@ -22,7 +22,12 @@ func next_operation(): operations[operation_idx].call() operation_idx += 1 + func fall_star_process(): for i in range(10): self.fall_star() - await get_tree().create_timer(randf_range(1.0,2.0)).timeout + await get_tree().create_timer(randf_range(1.0, 2.0)).timeout + + +func laser(): + pass diff --git a/scenes/weapons/star_wrath/star_wrath_root.gd b/scenes/weapons/star_wrath/star_wrath_root.gd index 7f4a30b..3875890 100644 --- a/scenes/weapons/star_wrath/star_wrath_root.gd +++ b/scenes/weapons/star_wrath/star_wrath_root.gd @@ -1,6 +1,9 @@ extends Node signal attack_finished +@onready var star_wrath = $StarWrath +@onready var bg = $Bg + # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -9,14 +12,17 @@ func _ready() -> void: else: hide() + func hide(): - $StarWrath.hide() - $Bg.hide() + star_wrath.hide() + bg.hide() + func show(): - $StarWrath.show() - $Bg.show() + star_wrath.show() + bg.show() + func start(): show() - $StarWrath.start() + star_wrath.start()