Improvements
This commit is contained in:
parent
9e3deaf3b0
commit
3f465a708c
@ -34,42 +34,31 @@ tracks/1/keys = {
|
|||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [true]
|
"values": [false]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_s6hcs"]
|
[sub_resource type="Animation" id="Animation_s6hcs"]
|
||||||
resource_name = "attack"
|
resource_name = "attack"
|
||||||
length = 0.5
|
length = 0.5
|
||||||
tracks/0/type = "bezier"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
tracks/0/path = NodePath("Sprite2D:frame")
|
tracks/0/path = NodePath("Sprite2D/Area2D:monitoring")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"handle_modes": PackedInt32Array(0, 0, 0, 0, 0, 0),
|
|
||||||
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 2, -0.25, 0, 0.25, 0, 3, -0.25, 0, 0.25, 0, 4, -0.25, 0, 0.25, 0, 5, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0),
|
|
||||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5)
|
|
||||||
}
|
|
||||||
tracks/1/type = "value"
|
|
||||||
tracks/1/imported = false
|
|
||||||
tracks/1/enabled = true
|
|
||||||
tracks/1/path = NodePath("Sprite2D/Area2D:monitoring")
|
|
||||||
tracks/1/interp = 1
|
|
||||||
tracks/1/loop_wrap = true
|
|
||||||
tracks/1/keys = {
|
|
||||||
"times": PackedFloat32Array(0, 0.4, 0.5),
|
"times": PackedFloat32Array(0, 0.4, 0.5),
|
||||||
"transitions": PackedFloat32Array(1, 1, 1),
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [false, true, false]
|
"values": [false, true, false]
|
||||||
}
|
}
|
||||||
tracks/2/type = "audio"
|
tracks/1/type = "audio"
|
||||||
tracks/2/imported = false
|
tracks/1/imported = false
|
||||||
tracks/2/enabled = true
|
tracks/1/enabled = true
|
||||||
tracks/2/path = NodePath("AudioStreamPlayer2D")
|
tracks/1/path = NodePath("AudioStreamPlayer2D")
|
||||||
tracks/2/interp = 1
|
tracks/1/interp = 1
|
||||||
tracks/2/loop_wrap = true
|
tracks/1/loop_wrap = true
|
||||||
tracks/2/keys = {
|
tracks/1/keys = {
|
||||||
"clips": [{
|
"clips": [{
|
||||||
"end_offset": 0.0,
|
"end_offset": 0.0,
|
||||||
"start_offset": 0.0,
|
"start_offset": 0.0,
|
||||||
@ -77,7 +66,19 @@ tracks/2/keys = {
|
|||||||
}],
|
}],
|
||||||
"times": PackedFloat32Array(0.3)
|
"times": PackedFloat32Array(0.3)
|
||||||
}
|
}
|
||||||
tracks/2/use_blend = true
|
tracks/1/use_blend = true
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("Sprite2D:frame")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [0, 1, 2, 3, 5]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_dbnl7"]
|
[sub_resource type="Animation" id="Animation_dbnl7"]
|
||||||
resource_name = "idle"
|
resource_name = "idle"
|
||||||
@ -155,6 +156,7 @@ targetPath = NodePath("..")
|
|||||||
trailLength = 8
|
trailLength = 8
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="Sprite2D"]
|
[node name="Area2D" type="Area2D" parent="Sprite2D"]
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite2D/Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite2D/Area2D"]
|
||||||
position = Vector2(24, -8)
|
position = Vector2(24, -8)
|
||||||
@ -168,6 +170,5 @@ libraries = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||||
stream = ExtResource("5_1dip1")
|
|
||||||
volume_db = -16.0
|
volume_db = -16.0
|
||||||
bus = &"Sound Effects"
|
bus = &"Sound Effects"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://bgdkduh2uevft"]
|
[gd_scene load_steps=6 format=3 uid="uid://bgdkduh2uevft"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/v2/enemy.gd" id="1_jfeur"]
|
[ext_resource type="Script" path="res://scripts/v2/enemy.gd" id="1_jfeur"]
|
||||||
[ext_resource type="Texture2D" uid="uid://iewpb4eaydo1" path="res://assets/art/Enemies/basic_enemy1.png" id="2_g0kyc"]
|
[ext_resource type="Texture2D" uid="uid://iewpb4eaydo1" path="res://assets/art/Enemies/basic_enemy1.png" id="2_g0kyc"]
|
||||||
@ -8,8 +8,13 @@
|
|||||||
radius = 3.0
|
radius = 3.0
|
||||||
height = 16.0
|
height = 16.0
|
||||||
|
|
||||||
[node name="BasicEnemy" type="CharacterBody2D"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_4efxi"]
|
||||||
|
radius = 64.0
|
||||||
|
|
||||||
|
[node name="BasicEnemy" type="CharacterBody2D" node_paths=PackedStringArray("sprite", "detection_area")]
|
||||||
script = ExtResource("1_jfeur")
|
script = ExtResource("1_jfeur")
|
||||||
|
sprite = NodePath("Sprite2D")
|
||||||
|
detection_area = NodePath("Area2D")
|
||||||
max_hp = 3
|
max_hp = 3
|
||||||
death_sound = ExtResource("2_pspk3")
|
death_sound = ExtResource("2_pspk3")
|
||||||
|
|
||||||
@ -19,3 +24,8 @@ texture = ExtResource("2_g0kyc")
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CapsuleShape2D_htsfi")
|
shape = SubResource("CapsuleShape2D_htsfi")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("CircleShape2D_4efxi")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="Resource" script_class="StandardWorldGenerator" load_steps=9 format=3 uid="uid://din7qhqccs2nr"]
|
[gd_resource type="Resource" script_class="StandardWorldGenerator" load_steps=11 format=3 uid="uid://din7qhqccs2nr"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/v2/worldgen/standard_generator.gd" id="1_dw1bv"]
|
[ext_resource type="Script" path="res://scripts/v2/worldgen/standard_generator.gd" id="1_dw1bv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://csuo1u5ickjbt" path="res://scenes/v2/worldgen/roomsets/standard/blocking.tscn" id="1_oci60"]
|
[ext_resource type="PackedScene" uid="uid://csuo1u5ickjbt" path="res://scenes/v2/worldgen/roomsets/standard/blocking.tscn" id="1_oci60"]
|
||||||
@ -8,9 +8,11 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bc5n3rb5t8ua7" path="res://scenes/v2/worldgen/roomsets/standard/small_room_down_right.tscn" id="5_ft2s4"]
|
[ext_resource type="PackedScene" uid="uid://bc5n3rb5t8ua7" path="res://scenes/v2/worldgen/roomsets/standard/small_room_down_right.tscn" id="5_ft2s4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://t511rr478gom" path="res://scenes/v2/worldgen/roomsets/standard/small_fork.tscn" id="6_ttx05"]
|
[ext_resource type="PackedScene" uid="uid://t511rr478gom" path="res://scenes/v2/worldgen/roomsets/standard/small_fork.tscn" id="6_ttx05"]
|
||||||
[ext_resource type="PackedScene" uid="uid://3vfg1g7uhjp2" path="res://scenes/v2/worldgen/roomsets/standard/spawn_room.tscn" id="7_pb65x"]
|
[ext_resource type="PackedScene" uid="uid://3vfg1g7uhjp2" path="res://scenes/v2/worldgen/roomsets/standard/spawn_room.tscn" id="7_pb65x"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c1071lricsfey" path="res://scenes/v2/worldgen/roomsets/standard/medium_hallway.tscn" id="8_wru8x"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://6g13ayie0xqg" path="res://scenes/v2/worldgen/roomsets/standard/medium_hallway_down.tscn" id="9_3wmjo"]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_dw1bv")
|
script = ExtResource("1_dw1bv")
|
||||||
rooms = Array[PackedScene]([ExtResource("1_oci60"), ExtResource("2_t3otv"), ExtResource("3_xlr3c"), ExtResource("4_tc4ie"), ExtResource("5_ft2s4"), ExtResource("6_ttx05")])
|
rooms = Array[PackedScene]([ExtResource("1_oci60"), ExtResource("2_t3otv"), ExtResource("3_xlr3c"), ExtResource("4_tc4ie"), ExtResource("5_ft2s4"), ExtResource("6_ttx05"), ExtResource("8_wru8x"), ExtResource("9_3wmjo")])
|
||||||
max_room_path_length = 10
|
max_room_path_length = 5
|
||||||
spawn_room = ExtResource("7_pb65x")
|
spawn_room = ExtResource("7_pb65x")
|
||||||
|
13
scenes/v2/worldgen/roomsets/standard/large_walkway.tscn
Normal file
13
scenes/v2/worldgen/roomsets/standard/large_walkway.tscn
Normal file
File diff suppressed because one or more lines are too long
12
scenes/v2/worldgen/roomsets/standard/medium_hallway.tscn
Normal file
12
scenes/v2/worldgen/roomsets/standard/medium_hallway.tscn
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c1071lricsfey"]
|
||||||
|
|
||||||
|
[ext_resource type="TileSet" uid="uid://cluemfplimly4" path="res://assets/tiles.tres" id="1_wfj1n"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/v2/worldgen/standard/room.gd" id="2_vqcoc"]
|
||||||
|
|
||||||
|
[node name="MediumHallway" type="TileMap"]
|
||||||
|
tile_set = ExtResource("1_wfj1n")
|
||||||
|
format = 2
|
||||||
|
layer_0/tile_data = PackedInt32Array(0, 0, 0, 65536, 0, 0, 131072, 0, 0, 196608, 0, 0, 262144, 0, 0, 524288, 0, 0, 589824, 0, 0, 655360, 0, 0, 720896, 0, 0, 1, 0, 0, 720897, 0, 0, 2, 0, 0, 655362, 0, 0, 720898, 0, 0, 3, 0, 0, 720899, 0, 0, 4, 0, 0, 720900, 0, 0, 5, 0, 0, 655365, 0, 0, 720901, 0, 0, 6, 0, 0, 720902, 0, 0, 720903, 0, 0, 720904, 0, 0, 655369, 0, 0, 720905, 0, 0, 10, 0, 0, 720906, 0, 0, 11, 0, 0, 720907, 0, 0, 12, 0, 0, 720908, 0, 0, 13, 0, 0, 589837, 0, 0, 720909, 0, 0, 14, 0, 0, 524302, 0, 0, 655374, 0, 0, 720910, 0, 0, 15, 0, 0, 589839, 0, 0, 720911, 0, 0, 16, 0, 0, 65552, 0, 0, 131088, 0, 0, 196624, 0, 0, 262160, 0, 0, 524304, 0, 0, 589840, 0, 0, 655376, 0, 0, 720912, 0, 0, 786432, 0, 0, 786433, 0, 0, 786434, 0, 0, 786435, 0, 0, 786436, 0, 0, 786437, 0, 0, 786438, 0, 0, 786439, 0, 0, 786440, 0, 0, 786441, 0, 0, 786442, 0, 0, 786443, 0, 0, 786444, 0, 0, 786445, 0, 0, 786446, 0, 0, 786447, 0, 0, 786448, 0, 0, 524289, 0, 0, 589825, 0, 0, 655361, 0, 0, 524290, 0, 0, 589826, 0, 0, 524291, 0, 0, 589827, 0, 0, 655363, 0, 0, 524292, 0, 0, 589828, 0, 0, 655364, 0, 0, 524293, 0, 0, 589829, 0, 0, 524294, 0, 0, 589830, 0, 0, 655366, 0, 0, 524295, 0, 0, 589831, 0, 0, 655367, 0, 0, 524296, 0, 0, 589832, 0, 0, 655368, 0, 0, 524297, 0, 0, 589833, 0, 0, 524298, 0, 0, 589834, 0, 0, 655370, 0, 0, 524299, 0, 0, 589835, 0, 0, 655371, 0, 0, 524300, 0, 0, 589836, 0, 0, 655372, 0, 0, 524301, 0, 0, 655373, 0, 0, 589838, 0, 0, 524303, 0, 0, 655375, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 262150, 0, 0, 262151, 0, 0, 262152, 0, 0, 262153, 0, 0, 262154, 0, 0, 327687, 0, 0, 393223, 0, 0, 458759, 0, 0, 327689, 0, 0, 393225, 0, 0, 458761, 0, 0, 327688, 0, 0, 393224, 0, 0, 458760, 0, 0, 262149, 1, 0, 262148, 1, 0, 262155, 1, 0, 262156, 1, 0, 196616, 3, 65536, 196613, 3, 196608, 196619, 3, 196608, 458754, 3, 196608, 458757, 3, 196608, 458763, 3, 196608, 458766, 3, 196608)
|
||||||
|
script = ExtResource("2_vqcoc")
|
||||||
|
left = true
|
||||||
|
right = true
|
@ -0,0 +1,13 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://6g13ayie0xqg"]
|
||||||
|
|
||||||
|
[ext_resource type="TileSet" uid="uid://cluemfplimly4" path="res://assets/tiles.tres" id="1_kd5p1"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/v2/worldgen/standard/room.gd" id="2_ex4sw"]
|
||||||
|
|
||||||
|
[node name="MediumHallwayDown" type="TileMap"]
|
||||||
|
tile_set = ExtResource("1_kd5p1")
|
||||||
|
format = 2
|
||||||
|
layer_0/tile_data = PackedInt32Array(0, 0, 0, 65536, 0, 0, 131072, 0, 0, 196608, 0, 0, 262144, 0, 0, 524288, 0, 0, 589824, 0, 0, 655360, 0, 0, 720896, 0, 0, 786432, 0, 0, 1, 0, 0, 786433, 0, 0, 2, 0, 0, 786434, 0, 0, 3, 0, 0, 786435, 0, 0, 4, 0, 0, 786436, 0, 0, 5, 0, 0, 786437, 0, 0, 6, 0, 0, 786438, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 0, 0, 786442, 0, 0, 11, 0, 0, 786443, 0, 0, 12, 0, 0, 786444, 0, 0, 13, 0, 0, 786445, 0, 0, 14, 0, 0, 786446, 0, 0, 15, 0, 0, 786447, 0, 0, 16, 0, 0, 65552, 0, 0, 131088, 0, 0, 196624, 0, 0, 262160, 0, 0, 524304, 0, 0, 589840, 0, 0, 655376, 0, 0, 720912, 0, 0, 786448, 0, 0, 524290, 0, 0, 524302, 0, 0, 524301, 1, 0, 524291, 1, 0, 524289, 0, 0, 589825, 0, 0, 655361, 0, 0, 720897, 0, 0, 524303, 0, 0, 589839, 0, 0, 655375, 0, 0, 720911, 0, 0, 65537, 0, 0, 131073, 0, 0, 196609, 0, 0, 262145, 0, 0, 65538, 0, 0, 131074, 0, 0, 196610, 0, 0, 262146, 0, 0, 65539, 0, 0, 131075, 0, 0, 196611, 0, 0, 262147, 0, 0, 65540, 0, 0, 131076, 0, 0, 196612, 0, 0, 262148, 0, 0, 65541, 0, 0, 131077, 0, 0, 196613, 0, 0, 262149, 0, 0, 65542, 0, 0, 131078, 0, 0, 196614, 0, 0, 262150, 0, 0, 65543, 0, 0, 131079, 0, 0, 196615, 0, 0, 262151, 0, 0, 65544, 0, 0, 131080, 0, 0, 196616, 0, 0, 262152, 0, 0, 65545, 0, 0, 131081, 0, 0, 196617, 0, 0, 262153, 0, 0, 65546, 0, 0, 131082, 0, 0, 196618, 0, 0, 262154, 0, 0, 65547, 0, 0, 131083, 0, 0, 196619, 0, 0, 262155, 0, 0, 65548, 0, 0, 131084, 0, 0, 196620, 0, 0, 262156, 0, 0, 65549, 0, 0, 131085, 0, 0, 196621, 0, 0, 262157, 0, 0, 65550, 0, 0, 131086, 0, 0, 196622, 0, 0, 262158, 0, 0, 65551, 0, 0, 131087, 0, 0, 196623, 0, 0, 262159, 0, 0, 589826, 0, 0, 655362, 0, 0, 720898, 0, 0, 589838, 0, 0, 655374, 0, 0, 720910, 0, 0, 458767, 3, 65536, 458753, 3, 65536, 720900, 3, 196608, 720908, 3, 196608)
|
||||||
|
script = ExtResource("2_ex4sw")
|
||||||
|
left = true
|
||||||
|
right = true
|
||||||
|
bottom = true
|
@ -8,7 +8,7 @@ var animation_player: AnimationPlayer
|
|||||||
var area: Area2D
|
var area: Area2D
|
||||||
|
|
||||||
@export
|
@export
|
||||||
var damage: int = 1
|
var damage: int = 3
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
self.init_equipment()
|
self.init_equipment()
|
||||||
|
@ -5,6 +5,7 @@ signal damaged(amount)
|
|||||||
signal healed(amount)
|
signal healed(amount)
|
||||||
signal death()
|
signal death()
|
||||||
|
|
||||||
|
@export_category("Creature")
|
||||||
@export
|
@export
|
||||||
var max_hp: int = 1
|
var max_hp: int = 1
|
||||||
|
|
||||||
@ -33,6 +34,8 @@ var hp: int :
|
|||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
self.hp = self.max_hp
|
self.hp = self.max_hp
|
||||||
self.death.connect(self._creature_on_death)
|
self.death.connect(self._creature_on_death)
|
||||||
|
if self.has_method("_on_ready"):
|
||||||
|
self.call("_on_ready")
|
||||||
|
|
||||||
func take_damage(damage: int) -> void:
|
func take_damage(damage: int) -> void:
|
||||||
self.hp -= damage
|
self.hp -= damage
|
||||||
|
@ -14,6 +14,12 @@ var state: State = State.IDLE
|
|||||||
@export
|
@export
|
||||||
var animation_player: AnimationPlayer
|
var animation_player: AnimationPlayer
|
||||||
|
|
||||||
|
@export
|
||||||
|
var sprite: Sprite2D
|
||||||
|
|
||||||
|
@export
|
||||||
|
var detection_area: Area2D
|
||||||
|
|
||||||
var _chase_target: Node2D
|
var _chase_target: Node2D
|
||||||
var _target_is_left: bool = false
|
var _target_is_left: bool = false
|
||||||
|
|
||||||
@ -29,9 +35,13 @@ func _play_animation(animation: String) -> void:
|
|||||||
|
|
||||||
animation_player.play(animation)
|
animation_player.play(animation)
|
||||||
|
|
||||||
|
func _on_ready() -> void:
|
||||||
|
self.detection_area.body_entered.connect(self._on_detection_area_entered)
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
var animation_name = str(State.keys()[self.state]).to_lower()
|
var animation_name = str(State.keys()[self.state]).to_lower()
|
||||||
self._play_animation(animation_name)
|
self._play_animation(animation_name)
|
||||||
|
sprite.flip_h = self._target_is_left
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
match self.state:
|
match self.state:
|
||||||
@ -39,4 +49,11 @@ func _physics_process(delta: float) -> void:
|
|||||||
if not self._chase_target:
|
if not self._chase_target:
|
||||||
self.state = State.IDLE
|
self.state = State.IDLE
|
||||||
|
|
||||||
pass
|
self._target_is_left = self._chase_target.position.x < self.position.x
|
||||||
|
|
||||||
|
func _on_detection_area_entered(body: CollisionObject2D) -> void:
|
||||||
|
match state:
|
||||||
|
State.IDLE:
|
||||||
|
if body is Player:
|
||||||
|
self._chase_target = body
|
||||||
|
self.state = State.CHASE
|
||||||
|
Loading…
Reference in New Issue
Block a user