Fix Explosion

main
Luna Brovchuk 2023-10-02 22:56:04 +02:00
parent d4973ef920
commit 0f2ab4af47
5 changed files with 11 additions and 9 deletions

View File

@ -3,7 +3,6 @@
[ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1] [ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1]
[sub_resource type="DynamicFont" id=1] [sub_resource type="DynamicFont" id=1]
size = 8
font_data = ExtResource( 1 ) font_data = ExtResource( 1 )
[resource] [resource]

View File

@ -7,9 +7,8 @@
[ext_resource path="res://src/models/explosion/sprites/1.png" type="Texture" id=5] [ext_resource path="res://src/models/explosion/sprites/1.png" type="Texture" id=5]
[ext_resource path="res://src/models/explosion/sprites/0.png" type="Texture" id=6] [ext_resource path="res://src/models/explosion/sprites/0.png" type="Texture" id=6]
[sub_resource type="CapsuleShape2D" id=1] [sub_resource type="CircleShape2D" id=3]
radius = 16.0 radius = 27.0
height = 10.0
[sub_resource type="SpriteFrames" id=2] [sub_resource type="SpriteFrames" id=2]
animations = [ { animations = [ {
@ -26,7 +25,7 @@ script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
rotation = 1.5708 rotation = 1.5708
shape = SubResource( 1 ) shape = SubResource( 3 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."] [node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = SubResource( 2 ) frames = SubResource( 2 )

View File

@ -1,13 +1,15 @@
extends StaticBody2D extends StaticBody2D
var damage = 10 var damage = 10
var damaged = []
func _ready(): func _physics_process(delta):
var areas = $Area2D.get_overlapping_areas() var areas = $Area2D.get_overlapping_areas()
for area in areas: for area in areas:
var parent = area.get_parent() var parent = area.get_parent()
if parent.is_in_group("enemy"): if parent.is_in_group("enemy") and not parent in damaged:
parent.deal_damage(damage) parent.deal_damage(damage)
damaged.append(parent)
func animation_finished(): func animation_finished():
call_deferred("free") call_deferred("free")

View File

@ -93,6 +93,7 @@ func get_damage():
"fireball": dmg += 8 "fireball": dmg += 8
"explode": dmg += 10 "explode": dmg += 10
"poison": dmg += 15 "poison": dmg += 15
return dmg
func _shoot(): func _shoot():
var ricochet_count = 0 var ricochet_count = 0

View File

@ -75,5 +75,6 @@ func _process(delta):
update_ui() update_ui()
func update_ui(): func update_ui():
$"UIWrapper/UI/Right/CastTime/CastTimeLabel".text = String(0) var player = $View/Player
$"UIWrapper/UI/Right/Damage/DamageLabel".text = String(0) $"UIWrapper/UI/Right/CastTime/CastTimeLabel".text = String(player.get_recharge())
$"UIWrapper/UI/Right/Damage/DamageLabel".text = String(player.get_damage())