-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
150 additions
and
6 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters