lashy improvements
This commit is contained in:
parent
19c8ee9566
commit
677480ad3d
6 changed files with 161 additions and 32 deletions
BIN
assets/textures/effects/star.png
Normal file
BIN
assets/textures/effects/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 719 B |
34
assets/textures/effects/star.png.import
Normal file
34
assets/textures/effects/star.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://350f21o7jrwq"
|
||||||
|
path="res://.godot/imported/star.png-38ac4bbd5414650c87c46e4e35f1e557.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/textures/effects/star.png"
|
||||||
|
dest_files=["res://.godot/imported/star.png-38ac4bbd5414650c87c46e4e35f1e557.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
|
|
@ -16,16 +16,18 @@ order = 2
|
||||||
|
|
||||||
[node name="Background" type="Sprite2D" parent="."]
|
[node name="Background" type="Sprite2D" parent="."]
|
||||||
modulate = Color(0.996924, 0.421436, 0, 1)
|
modulate = Color(0.996924, 0.421436, 0, 1)
|
||||||
|
z_index = -200
|
||||||
position = Vector2(144, 108)
|
position = Vector2(144, 108)
|
||||||
texture = ExtResource("1_h5jcm")
|
texture = ExtResource("1_h5jcm")
|
||||||
|
|
||||||
[node name="TileMap" type="TileMapLayer" parent="."]
|
[node name="TileMap" type="TileMapLayer" parent="."]
|
||||||
|
z_index = -100
|
||||||
use_parent_material = true
|
use_parent_material = true
|
||||||
tile_map_data = PackedByteArray("AAAAAAsAAAAAAAAAAAABAAsAAAAAAAAAAAACAAsAAAAAAAAAAAAHAAsAAAAAAAAAAAAIAAsAAAAAAAAAAAAJAAsAAAAAAAAAAAAKAAsAAAAAAAAAAAALAAsAAAAAAAAAAAANAAsAAAAAAAAAAAAOAAsAAAAAAAAAAAAPAAsAAAAAAAAAAAAQAAsAAAAAAAAAAAARAAsAAAAAAAAAAAADAAsAAAAAAAAAAAAEAAsAAAAAAAAAAAAFAAsAAAAAAAAAAAAGAAsAAAAAAAAAAAAMAAsAAAAAAAAAAAAFAAoAAAAAAAAAAAAGAAoAAAAAAAAAAAAGAAkAAAAAAAAAAAAHAAkAAAAAAAAAAAAIAAkAAAAAAAAAAAAJAAkAAAAAAAAAAAAKAAkAAAAAAAAAAAALAAkAAAAAAAAAAAAMAAkAAAAAAAAAAAALAAoAAAAAAAAAAAAKAAoAAAAAAAAAAAAJAAoAAAAAAAAAAAAIAAoAAAAAAAAAAAAHAAoAAAAAAAAAAAAMAAoAAAAAAAAAAAANAAoAAAAAAAAAAAAOAAoAAAAAAAAAAAAPAAoAAAAAAAAAAAAPAAkAAAAAAAAAAAAQAAkAAAAAAAAAAAAQAAgAAAAAAAAAAAAQAAcAAAAAAAAAAAAQAAYAAAAAAAAAAAARAAcAAAAAAAAAAAAQAAoAAAAAAAAAAAARAAkAAAAAAAAAAAARAAgAAAAAAAAAAAARAAoAAAAAAAAAAAARAAYAAAAAAAAAAAARAAUAAAAAAAAAAAARAAQAAAAAAAAAAAAQAAQAAAAAAAAAAAAQAAUAAAAAAAAAAAAFAAkAAAAAAAAAAAAEAAkAAAAAAAAAAAADAAkAAAAAAAAAAA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AAAAAAAAAAAAQAAUAAAAAAAAAAAAFAAkAAAAAAAAAAAAEAAkAAAAAAAAAAAADAAkAAAAAAAAAAAACAAkAAAAAAAAAAAABAAkAAAAAAAAAAAABAAoAAAAAAAAAAAACAAoAAAAAAAAAAAADAAoAAAAAAAAAAAAEAAoAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAkAAAAAAAAAAAABAAgAAAAAAAAAAAABAAcAAAAAAAAAAAABAAYAAAAAAAAAAAABAAUAAAAAAAAAAAABAAQAAAAAAAAAAAABAAMAAAAAAAAAAAABAAIAAAAAAAAAAAA=")
|
||||||
tile_set = ExtResource("2_dj7w1")
|
tile_set = ExtResource("2_dj7w1")
|
||||||
|
|
||||||
[node name="Lashy" parent="." instance=ExtResource("4_gykx6")]
|
[node name="Lashy" parent="." instance=ExtResource("4_gykx6")]
|
||||||
position = Vector2(160, 160)
|
position = Vector2(32, 144)
|
||||||
launch_power = 300.0
|
launch_power = 300.0
|
||||||
idle_radius = 6.0
|
idle_radius = 6.0
|
||||||
|
|
||||||
|
@ -33,7 +35,7 @@ idle_radius = 6.0
|
||||||
position = Vector2(120, 144)
|
position = Vector2(120, 144)
|
||||||
|
|
||||||
[node name="Spring" parent="." instance=ExtResource("6_tlqas")]
|
[node name="Spring" parent="." instance=ExtResource("6_tlqas")]
|
||||||
position = Vector2(96, 144)
|
position = Vector2(184, 144)
|
||||||
|
|
||||||
[node name="RotoBoy" parent="." instance=ExtResource("7_j1102")]
|
[node name="RotoBoy" parent="." instance=ExtResource("7_j1102")]
|
||||||
position = Vector2(240, 40)
|
position = Vector2(240, 40)
|
||||||
|
|
91
objects/enemies/lashy/blast_star.tscn
Normal file
91
objects/enemies/lashy/blast_star.tscn
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://bcgj0wb1ra11e"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://350f21o7jrwq" path="res://assets/textures/effects/star.png" id="1_1xc4y"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_1xc4y"]
|
||||||
|
resource_name = "blast"
|
||||||
|
length = 0.3
|
||||||
|
step = 0.1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:scale")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1e-05, 1e-05), Vector2(1.5, 1.5), Vector2(1e-05, 1e-05)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:rotation")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.3),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0, 1.5708]
|
||||||
|
}
|
||||||
|
tracks/2/type = "method"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath(".")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0.3),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [],
|
||||||
|
"method": &"queue_free"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_6qf6s"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Sprite2D:rotation")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kd46a"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_6qf6s"),
|
||||||
|
&"blast": SubResource("Animation_1xc4y")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="BlastStar" type="Node2D"]
|
||||||
|
z_index = -1
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_1xc4y")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_kd46a")
|
||||||
|
}
|
||||||
|
autoplay = "blast"
|
|
@ -14,30 +14,31 @@ extends Node2D
|
||||||
@export var time_recover: float
|
@export var time_recover: float
|
||||||
|
|
||||||
@export_group("Internal References")
|
@export_group("Internal References")
|
||||||
|
@export var smash_effect: PackedScene
|
||||||
@export var head: Node2D
|
@export var head: Node2D
|
||||||
|
|
||||||
|
|
||||||
var _player: Player = null
|
var _player: Player = null
|
||||||
var _tween: Tween = null
|
var _tween: Tween = null
|
||||||
|
var _go_again: bool = false
|
||||||
|
|
||||||
func _on_player_detector_body_entered(body: Node2D) -> void:
|
|
||||||
if body is Player:
|
|
||||||
_player = body
|
|
||||||
_start_attack()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_head_body_entered(body: Node2D) -> void:
|
|
||||||
if body is Player:
|
|
||||||
body.launch(global_position.direction_to(body.global_position) * launch_power)
|
|
||||||
|
|
||||||
|
|
||||||
func _start_attack() -> void:
|
func _start_attack() -> void:
|
||||||
# do nothing if already doing animation
|
# do nothing if already doing animation or player gone
|
||||||
if _tween and _tween.is_running():
|
if not _go_again or (_tween and _tween.is_running()):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
var effect = smash_effect.instantiate() as Node2D
|
||||||
|
effect.position = to_local(_player.global_position)
|
||||||
|
effect.rotation = randf() * TAU
|
||||||
|
|
||||||
_tween = create_tween().set_process_mode(Tween.TWEEN_PROCESS_PHYSICS)
|
_tween = create_tween().set_process_mode(Tween.TWEEN_PROCESS_PHYSICS)
|
||||||
|
# launch player
|
||||||
|
_tween.tween_callback(_player.launch.bind(
|
||||||
|
global_position.direction_to(_player.global_position) * launch_power
|
||||||
|
))
|
||||||
|
# spawn smash effect
|
||||||
|
_tween.tween_callback(add_child.bind(effect))
|
||||||
# draw back away from player
|
# draw back away from player
|
||||||
_tween.tween_property(head.material, ^"shader_parameter/radius", 0.0, 0.1)
|
_tween.tween_property(head.material, ^"shader_parameter/radius", 0.0, 0.1)
|
||||||
_tween.parallel().tween_method(_move_facing_player, 0.0, -draw_back_distance, time_draw_back)\
|
_tween.parallel().tween_method(_move_facing_player, 0.0, -draw_back_distance, time_draw_back)\
|
||||||
|
@ -49,6 +50,7 @@ func _start_attack() -> void:
|
||||||
_tween.tween_method(_move_facing_player, smash_distance, 0.0, time_recover)\
|
_tween.tween_method(_move_facing_player, smash_distance, 0.0, time_recover)\
|
||||||
.set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BOUNCE)
|
.set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BOUNCE)
|
||||||
_tween.tween_property(head.material, ^"shader_parameter/radius", idle_radius, 0.1)
|
_tween.tween_property(head.material, ^"shader_parameter/radius", idle_radius, 0.1)
|
||||||
|
_tween.tween_callback(_start_attack.call_deferred)
|
||||||
|
|
||||||
|
|
||||||
## move head this disatance from (0,0) towards (or away if negative) from player
|
## move head this disatance from (0,0) towards (or away if negative) from player
|
||||||
|
@ -58,3 +60,15 @@ func _move_facing_player(distance: float) -> void:
|
||||||
|
|
||||||
var dir = global_position.direction_to(_player.global_position)
|
var dir = global_position.direction_to(_player.global_position)
|
||||||
head.position = dir * distance
|
head.position = dir * distance
|
||||||
|
|
||||||
|
|
||||||
|
func _on_player_detector_body_entered(body: Node2D) -> void:
|
||||||
|
if body is Player:
|
||||||
|
_player = body
|
||||||
|
_go_again = true
|
||||||
|
_start_attack()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_player_detector_body_exited(body: Node2D) -> void:
|
||||||
|
if body is Player:
|
||||||
|
_go_again = false
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://lxppe1op1240" path="res://objects/enemies/lashy/lashy.gd" id="1_34o54"]
|
[ext_resource type="Script" uid="uid://lxppe1op1240" path="res://objects/enemies/lashy/lashy.gd" id="1_34o54"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cm4cantqbhkwx" path="res://assets/textures/enemies/lashy/lashy_anchor.png" id="2_8ls3k"]
|
[ext_resource type="Texture2D" uid="uid://cm4cantqbhkwx" path="res://assets/textures/enemies/lashy/lashy_anchor.png" id="2_8ls3k"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bcgj0wb1ra11e" path="res://objects/enemies/lashy/blast_star.tscn" id="2_42oum"]
|
||||||
[ext_resource type="Script" uid="uid://bt4bdjyekgh53" path="res://scripts/ball_snake/ball_snake.gd" id="3_8edxw"]
|
[ext_resource type="Script" uid="uid://bt4bdjyekgh53" path="res://scripts/ball_snake/ball_snake.gd" id="3_8edxw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://gnkke4rr0wcr" path="res://assets/textures/enemies/lashy/lashy_body.png" id="4_xnkdk"]
|
[ext_resource type="Texture2D" uid="uid://gnkke4rr0wcr" path="res://assets/textures/enemies/lashy/lashy_body.png" id="4_xnkdk"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bf0i64q2dw0au" path="res://assets/textures/enemies/lashy/lashy_head.png" id="5_b5g1y"]
|
[ext_resource type="Texture2D" uid="uid://bf0i64q2dw0au" path="res://assets/textures/enemies/lashy/lashy_head.png" id="5_b5g1y"]
|
||||||
|
@ -17,18 +18,16 @@ shader = ExtResource("5_dkkk6")
|
||||||
shader_parameter/radius = 6.0
|
shader_parameter/radius = 6.0
|
||||||
shader_parameter/speed = 3.142
|
shader_parameter/speed = 3.142
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_g5iss"]
|
|
||||||
radius = 6.0
|
|
||||||
|
|
||||||
[node name="Lashy" type="Node2D" node_paths=PackedStringArray("head")]
|
[node name="Lashy" type="Node2D" node_paths=PackedStringArray("head")]
|
||||||
script = ExtResource("1_34o54")
|
script = ExtResource("1_34o54")
|
||||||
launch_power = 240.0
|
launch_power = 240.0
|
||||||
idle_radius = 4.0
|
idle_radius = 4.0
|
||||||
draw_back_distance = 24.0
|
draw_back_distance = 24.0
|
||||||
smash_distance = 32.0
|
smash_distance = 32.0
|
||||||
time_draw_back = 0.2
|
time_draw_back = 0.1
|
||||||
time_smash = 0.2
|
time_smash = 0.2
|
||||||
time_recover = 0.1
|
time_recover = 0.1
|
||||||
|
smash_effect = ExtResource("2_42oum")
|
||||||
head = NodePath("Head")
|
head = NodePath("Head")
|
||||||
|
|
||||||
[node name="PlayerDetector" type="Area2D" parent="."]
|
[node name="PlayerDetector" type="Area2D" parent="."]
|
||||||
|
@ -52,20 +51,9 @@ head_segment = false
|
||||||
auto_density = true
|
auto_density = true
|
||||||
pixels_per_segment = 5.0
|
pixels_per_segment = 5.0
|
||||||
|
|
||||||
[node name="Head" type="Area2D" parent="."]
|
[node name="Head" type="Sprite2D" parent="."]
|
||||||
material = SubResource("ShaderMaterial_42oum")
|
material = SubResource("ShaderMaterial_42oum")
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 16
|
|
||||||
monitorable = false
|
|
||||||
metadata/_edit_group_ = true
|
|
||||||
|
|
||||||
[node name="HeadSprite" type="Sprite2D" parent="Head"]
|
|
||||||
use_parent_material = true
|
|
||||||
texture = ExtResource("5_b5g1y")
|
texture = ExtResource("5_b5g1y")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Head"]
|
|
||||||
shape = SubResource("CircleShape2D_g5iss")
|
|
||||||
debug_color = Color(1, 0, 0, 0.419608)
|
|
||||||
|
|
||||||
[connection signal="body_entered" from="PlayerDetector" to="." method="_on_player_detector_body_entered"]
|
[connection signal="body_entered" from="PlayerDetector" to="." method="_on_player_detector_body_entered"]
|
||||||
[connection signal="body_entered" from="Head" to="." method="_on_head_body_entered"]
|
[connection signal="body_exited" from="PlayerDetector" to="." method="_on_player_detector_body_exited"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue