Compare commits
No commits in common. "65ba4684ead69ea900d1d364419ead947a997746" and "434fc41db4cae3da0ce4ada143c704af7f488d6a" have entirely different histories.
65ba4684ea
...
434fc41db4
5 changed files with 14 additions and 44 deletions
|
|
@ -12,7 +12,6 @@ var chase_range = 1400
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
player = get_tree().get_root().get_node_or_null("main/Player")
|
player = get_tree().get_root().get_node_or_null("main/Player")
|
||||||
$AnimatedSprite2D.play("default")
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if !is_instance_valid(player):
|
if !is_instance_valid(player):
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,12 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://chu67ci7sl488"]
|
[gd_scene load_steps=6 format=3 uid="uid://chu67ci7sl488"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://12jns4dppxxj" path="res://enemies/ghost.gd" id="1_6attn"]
|
[ext_resource type="Script" uid="uid://12jns4dppxxj" path="res://enemies/ghost.gd" id="1_6attn"]
|
||||||
[ext_resource type="PackedScene" uid="uid://mtfsdd4cdf3a" path="res://utils/enemy_hurtbox.tscn" id="2_34o1m"]
|
[ext_resource type="PackedScene" uid="uid://mtfsdd4cdf3a" path="res://utils/enemy_hurtbox.tscn" id="2_34o1m"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d3b5hmhjw2jyc" path="res://enemies/ghost animation/Ghost 1.png" id="3_34o1m"]
|
[ext_resource type="Texture2D" uid="uid://d3b5hmhjw2jyc" path="res://enemies/ghost animation/Ghost 1.png" id="3_34o1m"]
|
||||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_obmiq"]
|
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_obmiq"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dfhxhum8lek56" path="res://enemies/ghost animation/Ghost 2.png" id="4_4awot"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ve5px6ib45g" path="res://enemies/ghost animation/Ghost 3.png" id="5_etobg"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cmg8yws3gwx6u" path="res://enemies/ghost animation/Ghost 4.png" id="6_kbrsm"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bs3lt13umfxu8" path="res://enemies/ghost animation/Ghost 5.png" id="7_a4rx2"]
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6attn"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_6attn"]
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_je28r"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("3_34o1m")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("4_4awot")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("5_etobg")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("6_kbrsm")
|
|
||||||
}, {
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("7_a4rx2")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"default",
|
|
||||||
"speed": 5.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[node name="Ghost" type="Area2D"]
|
[node name="Ghost" type="Area2D"]
|
||||||
z_index = 1
|
z_index = 1
|
||||||
scale = Vector2(0.8, 0.8)
|
scale = Vector2(0.8, 0.8)
|
||||||
|
|
@ -41,17 +14,15 @@ collision_layer = 0
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
script = ExtResource("1_6attn")
|
script = ExtResource("1_6attn")
|
||||||
|
|
||||||
[node name="EnemyHurtbox" parent="." node_paths=PackedStringArray("canvasItem") instance=ExtResource("2_34o1m")]
|
[node name="EnemyHurtbox" parent="." instance=ExtResource("2_34o1m")]
|
||||||
max_hp = 50
|
max_hp = 50
|
||||||
canvasItem = NodePath("..")
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyHurtbox"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyHurtbox"]
|
||||||
scale = Vector2(6, 6)
|
scale = Vector2(6, 6)
|
||||||
shape = SubResource("CircleShape2D_6attn")
|
shape = SubResource("CircleShape2D_6attn")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_je28r")
|
texture = ExtResource("3_34o1m")
|
||||||
frame_progress = 0.235914
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
scale = Vector2(5, 5)
|
scale = Vector2(5, 5)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://b62xcg0dd3vct"]
|
[gd_scene load_steps=6 format=3 uid="uid://b62xcg0dd3vct"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b70f2ylbb3btt" path="res://enemies/leech.gd" id="1_6u582"]
|
[ext_resource type="Script" uid="uid://b70f2ylbb3btt" path="res://enemies/leech.gd" id="1_6u582"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cvoicwo2xnf7e" path="res://segment.tscn" id="2_oqch2"]
|
[ext_resource type="PackedScene" uid="uid://cvoicwo2xnf7e" path="res://segment.tscn" id="2_oqch2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_0r7dp"]
|
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_0r7dp"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://djfc7sdc8wxp6" path="res://player/Heart_cut.png" id="4_cq6dk"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cq6dk"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cq6dk"]
|
||||||
size = Vector2(2, 24)
|
size = Vector2(2, 24)
|
||||||
|
|
@ -37,6 +38,11 @@ position = Vector2(248, 31.2)
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 8
|
collision_mask = 8
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="RayCast2D"]
|
||||||
|
position = Vector2(0, 15)
|
||||||
|
scale = Vector2(0.05, 0.5)
|
||||||
|
texture = ExtResource("4_cq6dk")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RayCast2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="RayCast2D"]
|
||||||
position = Vector2(0, 14.8)
|
position = Vector2(0, 14.8)
|
||||||
shape = SubResource("RectangleShape2D_cq6dk")
|
shape = SubResource("RectangleShape2D_cq6dk")
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,8 @@ texture = ExtResource("2_sa5vt")
|
||||||
scale = Vector2(2, 1)
|
scale = Vector2(2, 1)
|
||||||
shape = SubResource("RectangleShape2D_fgt1l")
|
shape = SubResource("RectangleShape2D_fgt1l")
|
||||||
|
|
||||||
[node name="EnemyHurtbox" parent="." node_paths=PackedStringArray("canvasItem") instance=ExtResource("3_sa5vt")]
|
[node name="EnemyHurtbox" parent="." instance=ExtResource("3_sa5vt")]
|
||||||
canvasItem = NodePath("..")
|
hit_invulnerability = 0.0
|
||||||
flashColor = Color(2.00392, 2.00392, 2.00392, 1)
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyHurtbox"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyHurtbox"]
|
||||||
scale = Vector2(2, 1)
|
scale = Vector2(2, 1)
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@ extends Area2D
|
||||||
|
|
||||||
@export var max_hp : int
|
@export var max_hp : int
|
||||||
@onready var hp = max_hp
|
@onready var hp = max_hp
|
||||||
@export var hit_invulnerability = 0.2
|
@export var hit_invulnerability = 0.35
|
||||||
@export var canvasItem : CanvasItem
|
|
||||||
@export var flashColor : Color = Color(1.5, 1.5, 1.5)
|
|
||||||
var inv_time = 0;
|
var inv_time = 0;
|
||||||
|
|
||||||
signal damage_taken
|
signal damage_taken
|
||||||
|
|
@ -12,12 +10,9 @@ signal died
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
inv_time = max(inv_time-delta, 0)
|
inv_time = max(inv_time-delta, 0)
|
||||||
if(inv_time <= 0 and canvasItem != null):
|
|
||||||
canvasItem.modulate = Color(1,1,1)
|
|
||||||
|
|
||||||
func hurt(damage : int, dir : Vector2 = Vector2.ZERO):
|
func hurt(damage : int, dir : Vector2 = Vector2.ZERO):
|
||||||
if(inv_time<=0):
|
if(inv_time<=0):
|
||||||
if canvasItem != null: canvasItem.modulate = flashColor
|
|
||||||
inv_time = hit_invulnerability
|
inv_time = hit_invulnerability
|
||||||
hp = max(hp-damage, 0)
|
hp = max(hp-damage, 0)
|
||||||
damage_taken.emit(damage, dir)
|
damage_taken.emit(damage, dir)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue