Add animation effect to area damage
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
25d1dadded
commit
9a9fdbde4e
5 changed files with 142 additions and 4 deletions
BIN
assets/spritesheets/explosion.png
Normal file
BIN
assets/spritesheets/explosion.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 MiB |
34
assets/spritesheets/explosion.png.import
Normal file
34
assets/spritesheets/explosion.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://vpx6vs4ufycr"
|
||||||
|
path="res://.godot/imported/explosion.png-886739e81fcc3dcfae2147b72459ccad.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/spritesheets/explosion.png"
|
||||||
|
dest_files=["res://.godot/imported/explosion.png-886739e81fcc3dcfae2147b72459ccad.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
|
|
@ -1,11 +1,86 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://dqa80ptcc8p70"]
|
[gd_scene load_steps=16 format=3 uid="uid://dqa80ptcc8p70"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/bullets/bullet.gd" id="1_lacqw"]
|
[ext_resource type="Script" path="res://scripts/bullets/bullet.gd" id="1_lacqw"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c57taqe4k3mi2" path="res://assets/spritesheets/bullet-1.png" id="2_o8iut"]
|
[ext_resource type="Texture2D" uid="uid://c57taqe4k3mi2" path="res://assets/spritesheets/bullet-1.png" id="2_o8iut"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://vpx6vs4ufycr" path="res://assets/spritesheets/explosion.png" id="3_wtt2i"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_3cgpo"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_3cgpo"]
|
||||||
radius = 6.0
|
radius = 6.0
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_dyohr"]
|
||||||
|
radius = 88.0511
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_2161y"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(0, 0, 1500, 1125)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_iaa62"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(1500, 0, 1500, 1125)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_6haw2"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(3000, 0, 1500, 1125)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_k4fug"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(0, 1100, 1500, 1700)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_icmj8"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(1500, 1100, 1500, 1700)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_cckbs"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(3000, 1100, 1500, 1700)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_s5xhq"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(0, 2700, 1500, 1500)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_sxyjv"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(1500, 2700, 1500, 1500)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_50qmh"]
|
||||||
|
atlas = ExtResource("3_wtt2i")
|
||||||
|
region = Rect2(3000, 2700, 1500, 1500)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_88q0q"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_2161y")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_iaa62")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_6haw2")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_k4fug")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_icmj8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_cckbs")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_s5xhq")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_sxyjv")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_50qmh")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 12.0
|
||||||
|
}]
|
||||||
|
|
||||||
[node name="bullet" type="Area2D"]
|
[node name="bullet" type="Area2D"]
|
||||||
script = ExtResource("1_lacqw")
|
script = ExtResource("1_lacqw")
|
||||||
|
|
||||||
|
@ -19,5 +94,19 @@ shape = SubResource("CircleShape2D_3cgpo")
|
||||||
|
|
||||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_dyohr")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
scale = Vector2(0.15, 0.15)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_88q0q")
|
||||||
|
frame = 7
|
||||||
|
frame_progress = 0.957328
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_Bullet_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_Bullet_body_entered"]
|
||||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
||||||
|
[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"]
|
||||||
|
[connection signal="body_exited" from="Area2D" to="." method="_on_body_exited"]
|
||||||
|
|
|
@ -6,10 +6,14 @@ var speed: int = 0
|
||||||
var damage: int = 0
|
var damage: int = 0
|
||||||
var dir = 0
|
var dir = 0
|
||||||
var area_damage: bool = false
|
var area_damage: bool = false
|
||||||
var area_damage_target = []
|
|
||||||
var slow_effect: bool = false
|
var slow_effect: bool = false
|
||||||
|
|
||||||
|
var enemies = []
|
||||||
|
var stop: bool = false
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
|
if stop:
|
||||||
|
return
|
||||||
var move_dir = Vector2(1,0).rotated(dir)
|
var move_dir = Vector2(1,0).rotated(dir)
|
||||||
global_position += (move_dir * speed)
|
global_position += (move_dir * speed)
|
||||||
|
|
||||||
|
@ -19,11 +23,23 @@ func _on_VisibilityNotifier2D_screen_exited():
|
||||||
func _on_Bullet_body_entered(body):
|
func _on_Bullet_body_entered(body):
|
||||||
if body.is_in_group("Enemy"):
|
if body.is_in_group("Enemy"):
|
||||||
if area_damage:
|
if area_damage:
|
||||||
for enemy in area_damage_target:
|
$Sprite2D.hide()
|
||||||
|
stop = true
|
||||||
|
$AnimatedSprite2D.visible = true
|
||||||
|
$AnimatedSprite2D.play("default")
|
||||||
|
for enemy in enemies:
|
||||||
enemy.hit(damage)
|
enemy.hit(damage)
|
||||||
|
await get_tree().create_timer(1).timeout
|
||||||
elif slow_effect:
|
elif slow_effect:
|
||||||
body.get_parent().hit(damage)
|
body.get_parent().hit(damage)
|
||||||
body.get_parent().slow()
|
body.get_parent().slow()
|
||||||
else:
|
else:
|
||||||
body.get_parent().hit(damage)
|
body.get_parent().hit(damage)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
func _on_body_entered(body):
|
||||||
|
if body.is_in_group("Enemy"):
|
||||||
|
enemies.append(body.get_parent())
|
||||||
|
|
||||||
|
func _on_body_exited(body):
|
||||||
|
enemies.erase(body.get_parent())
|
|
@ -73,7 +73,6 @@ func _shoot():
|
||||||
bullet_instance.speed = speed
|
bullet_instance.speed = speed
|
||||||
bullet_instance.damage = damage
|
bullet_instance.damage = damage
|
||||||
bullet_instance.area_damage = area_damage
|
bullet_instance.area_damage = area_damage
|
||||||
bullet_instance.area_damage_target = enemies
|
|
||||||
bullet_instance.slow_effect = slow_effect
|
bullet_instance.slow_effect = slow_effect
|
||||||
get_tree().current_scene.add_child(bullet_instance)
|
get_tree().current_scene.add_child(bullet_instance)
|
||||||
health -= durability_reduction
|
health -= durability_reduction
|
||||||
|
|
Loading…
Reference in a new issue