diff --git a/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.md5 b/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.md5 index 791a4d1..659e21f 100644 --- a/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.md5 +++ b/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.md5 @@ -1,3 +1,3 @@ source_md5="8c97e935786b994c3cff4008212381b9" -dest_md5="95f9f4dfdc6535bb78f265d86373e65e" +dest_md5="2ae8fab63415433bb13b0ee2b9c689cb" diff --git a/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.stex b/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.stex index aa8bfe2..2fa21f0 100644 Binary files a/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.stex and b/.import/goblin_idle_spritesheet.png-aef10c686a5967a1767056ccd7ee312d.stex differ diff --git a/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.md5 b/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.md5 index 332d0dd..d9bede5 100644 --- a/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.md5 +++ b/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.md5 @@ -1,3 +1,3 @@ source_md5="ee2cf371bf7f1107007e67b62680a86b" -dest_md5="501ca82ac953257960b45b55f8a3b4ae" +dest_md5="23f4c0e52d0d2dd5cfcce1b99d33fc36" diff --git a/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.stex b/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.stex index be554d0..d5a3055 100644 Binary files a/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.stex and b/.import/goblin_knife.png-4461242fc35ba4832657ab1a22ed648e.stex differ diff --git a/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.md5 b/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.md5 index d451ace..419c17f 100644 --- a/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.md5 +++ b/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.md5 @@ -1,3 +1,3 @@ source_md5="565c2f9a0bb01a9c56975664f8cd375c" -dest_md5="b1dabbd61e5fab5ecb683741906255c8" +dest_md5="1396d62ebda6149cad7dd800805a6f69" diff --git a/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.stex b/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.stex index 7cbb36c..b02642a 100644 Binary files a/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.stex and b/.import/goblin_run_spritesheet.png-120d6a6e3b00bd38e486d50facff5ae9.stex differ diff --git a/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_idle_spritesheet.png.import b/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_idle_spritesheet.png.import index 4968484..6d08626 100644 --- a/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_idle_spritesheet.png.import +++ b/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_idle_spritesheet.png.import @@ -20,7 +20,7 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=true +flags/filter=false flags/mipmaps=false flags/anisotropic=false flags/srgb=2 @@ -30,5 +30,5 @@ process/HDR_as_SRGB=false process/invert_color=false stream=false size_limit=0 -detect_3d=true +detect_3d=false svg/scale=1.0 diff --git a/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_knife.png.import b/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_knife.png.import index 1d905ae..f5bb141 100644 --- a/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_knife.png.import +++ b/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_knife.png.import @@ -20,7 +20,7 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=true +flags/filter=false flags/mipmaps=false flags/anisotropic=false flags/srgb=2 @@ -30,5 +30,5 @@ process/HDR_as_SRGB=false process/invert_color=false stream=false size_limit=0 -detect_3d=true +detect_3d=false svg/scale=1.0 diff --git a/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_run_spritesheet.png.import b/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_run_spritesheet.png.import index 764d2c8..7045508 100644 --- a/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_run_spritesheet.png.import +++ b/Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_run_spritesheet.png.import @@ -20,7 +20,7 @@ compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 flags/repeat=0 -flags/filter=true +flags/filter=false flags/mipmaps=false flags/anisotropic=false flags/srgb=2 @@ -30,5 +30,5 @@ process/HDR_as_SRGB=false process/invert_color=false stream=false size_limit=0 -detect_3d=true +detect_3d=false svg/scale=1.0 diff --git a/Characters/Enemies/Enemy.gd b/Characters/Enemies/Enemy.gd index 47baf54..acfc453 100644 --- a/Characters/Enemies/Enemy.gd +++ b/Characters/Enemies/Enemy.gd @@ -12,7 +12,7 @@ func chase() -> void: if path: var vector_to_next_point: Vector2 = path[0] - global_position var distance_to_next_point: float = vector_to_next_point.length() - if distance_to_next_point < 1: + if distance_to_next_point < 3: path.remove(0) if not path: return @@ -26,8 +26,12 @@ func chase() -> void: func _on_PathTimer_timeout() -> void: if is_instance_valid(player): - path = navigation.get_simple_path(global_position, player.position) + _get_path_to_player() else: path_timer.stop() path = [] mov_direction = Vector2.ZERO + + +func _get_path_to_player() -> void: + path = navigation.get_simple_path(global_position, player.position) diff --git a/Characters/Enemies/Goblin/Goblin.gd b/Characters/Enemies/Goblin/Goblin.gd new file mode 100644 index 0000000..ddd8570 --- /dev/null +++ b/Characters/Enemies/Goblin/Goblin.gd @@ -0,0 +1,48 @@ +extends Enemy + +const THROWABLE_KNIFE_SCENE: PackedScene = preload("res://Characters/Enemies/Goblin/ThrowableKnike.tscn") + +const MAX_DISTANCE_TO_PLAYER: int = 80 +const MIN_DISTANCE_TO_PLAYER: int = 40 + +export(int) var projectile_speed: int = 150 + +var can_attack: bool = true + +var distance_to_player: float + +onready var attack_timer: Timer = get_node("AttackTimer") + + +func _on_PathTimer_timeout() -> void: + if is_instance_valid(player): + distance_to_player = (player.position - global_position).length() + if distance_to_player > MAX_DISTANCE_TO_PLAYER: + _get_path_to_player() + elif distance_to_player < MIN_DISTANCE_TO_PLAYER: + _get_path_to_move_away_from_player() + else: + if can_attack: + can_attack = false + _throw_knife() + attack_timer.start() + else: + path_timer.stop() + path = [] + mov_direction = Vector2.ZERO + + +func _get_path_to_move_away_from_player() -> void: + var dir: Vector2 = (global_position - player.position).normalized() + path = navigation.get_simple_path(global_position, global_position + dir * 100) + + +func _throw_knife() -> void: + var projectile: Area2D = THROWABLE_KNIFE_SCENE.instance() + projectile.launch(global_position, (player.position - global_position).normalized(), projectile_speed) + get_tree().current_scene.add_child(projectile) + + + +func _on_AttackTimer_timeout() -> void: + can_attack = true diff --git a/Characters/Enemies/Goblin/Goblin.tscn b/Characters/Enemies/Goblin/Goblin.tscn new file mode 100644 index 0000000..de0c252 --- /dev/null +++ b/Characters/Enemies/Goblin/Goblin.tscn @@ -0,0 +1,273 @@ +[gd_scene load_steps=29 format=2] + +[ext_resource path="res://Characters/Enemies/Enemy.tscn" type="PackedScene" id=1] +[ext_resource path="res://Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_idle_spritesheet.png" type="Texture" id=2] +[ext_resource path="res://Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_run_spritesheet.png" type="Texture" id=3] +[ext_resource path="res://Art/v1.1 dungeon crawler 16x16 pixel pack/effects (new)/enemy_afterdead_explosion_anim_spritesheet.png" type="Texture" id=4] +[ext_resource path="res://Characters/Enemies/Goblin/Goblin.gd" type="Script" id=5] +[ext_resource path="res://Characters/Enemies/Goblin/GoblinFSM.gd" type="Script" id=6] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 2 ) +region = Rect2( 0, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 2 ) +region = Rect2( 16, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 2 ) +region = Rect2( 32, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 2 ) +region = Rect2( 48, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=5] +atlas = ExtResource( 2 ) +region = Rect2( 64, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=6] +atlas = ExtResource( 2 ) +region = Rect2( 80, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=7] +atlas = ExtResource( 3 ) +region = Rect2( 0, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=8] +atlas = ExtResource( 3 ) +region = Rect2( 16, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=9] +atlas = ExtResource( 3 ) +region = Rect2( 32, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=10] +atlas = ExtResource( 3 ) +region = Rect2( 48, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=11] +atlas = ExtResource( 3 ) +region = Rect2( 64, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=12] +atlas = ExtResource( 3 ) +region = Rect2( 80, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=13] +atlas = ExtResource( 4 ) +region = Rect2( 0, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=14] +atlas = ExtResource( 4 ) +region = Rect2( 16, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=15] +atlas = ExtResource( 4 ) +region = Rect2( 32, 0, 16, 16 ) + +[sub_resource type="AtlasTexture" id=16] +atlas = ExtResource( 4 ) +region = Rect2( 48, 0, 16, 16 ) + +[sub_resource type="SpriteFrames" id=17] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ], +"loop": true, +"name": "idle", +"speed": 5.0 +}, { +"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], +"loop": true, +"name": "move", +"speed": 5.0 +}, { +"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ) ], +"loop": true, +"name": "explosion", +"speed": 5.0 +} ] + +[sub_resource type="CircleShape2D" id=18] +radius = 4.0 + +[sub_resource type="Animation" id=19] +resource_name = "dead" +tracks/0/type = "value" +tracks/0/path = NodePath("AnimatedSprite:animation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.6 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ "idle", "explosion" ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("AnimatedSprite:frame") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.6, 0.7, 0.8, 0.9 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 3, 0, 1, 2, 3 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("AnimatedSprite:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 1, +"values": [ false, true, false, true ] +} +tracks/3/type = "method" +tracks/3/path = NodePath(".") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 1 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "queue_free" +} ] +} + +[sub_resource type="Animation" id=20] +resource_name = "hurt" +tracks/0/type = "value" +tracks/0/path = NodePath("AnimatedSprite:animation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ "idle" ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("AnimatedSprite:frame") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 3 ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("AnimatedSprite:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.1, 0.2, 0.3 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 1, +"values": [ false, true, false, true ] +} + +[sub_resource type="Animation" id=21] +length = 0.6 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("AnimatedSprite:animation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ "idle" ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("AnimatedSprite:frame") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 1, 2, 3, 4, 5 ] +} + +[sub_resource type="Animation" id=22] +length = 0.6 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("AnimatedSprite:animation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ "move" ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("AnimatedSprite:frame") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ 0, 1, 2, 3, 4, 5 ] +} + +[node name="Goblin" instance=ExtResource( 1 )] +script = ExtResource( 5 ) +accerelation = 30 +max_speed = 75 + +[node name="FiniteStateMachine" parent="." index="0"] +script = ExtResource( 6 ) + +[node name="AnimatedSprite" parent="." index="1"] +frames = SubResource( 17 ) +animation = "explosion" +frame = 3 + +[node name="CollisionShape2D" parent="." index="2"] +position = Vector2( 1, 2 ) +shape = SubResource( 18 ) + +[node name="AnimationPlayer" parent="." index="3"] +anims/dead = SubResource( 19 ) +anims/hurt = SubResource( 20 ) +anims/idle = SubResource( 21 ) +anims/move = SubResource( 22 ) + +[node name="PathTimer" parent="." index="4"] +wait_time = 0.2 + +[node name="AttackTimer" type="Timer" parent="." index="5"] +wait_time = 1.5 +one_shot = true + +[connection signal="timeout" from="AttackTimer" to="." method="_on_AttackTimer_timeout"] diff --git a/Characters/Enemies/Goblin/GoblinFSM.gd b/Characters/Enemies/Goblin/GoblinFSM.gd new file mode 100644 index 0000000..2435b29 --- /dev/null +++ b/Characters/Enemies/Goblin/GoblinFSM.gd @@ -0,0 +1,45 @@ +extends FiniteStateMachine + + +func _init() -> void: + _add_state("idle") + _add_state("move") + _add_state("hurt") + _add_state("dead") + + +func _ready() -> void: + set_state(states.move) + + +func _state_logic(_delta: float) -> void: + if state == states.move: + parent.chase() + parent.move() + + +func _get_transition() -> int: + match state: + states.idle: + if parent.distance_to_player > parent.MAX_DISTANCE_TO_PLAYER or parent.distance_to_player < parent.MIN_DISTANCE_TO_PLAYER: + return states.move + states.move: + if parent.distance_to_player < parent.MAX_DISTANCE_TO_PLAYER and parent.distance_to_player > parent.MIN_DISTANCE_TO_PLAYER: + return states.idle + states.hurt: + if not animation_player.is_playing(): + return states.move + return -1 + + +func _enter_state(_previous_state: int, new_state: int) -> void: + match new_state: + states.idle: + animation_player.play("idle") + states.move: + animation_player.play("move") + states.hurt: + animation_player.play("hurt") + states.dead: + animation_player.play("dead") + diff --git a/Characters/Enemies/Goblin/ThrowableKnike.gd b/Characters/Enemies/Goblin/ThrowableKnike.gd new file mode 100644 index 0000000..3d98750 --- /dev/null +++ b/Characters/Enemies/Goblin/ThrowableKnike.gd @@ -0,0 +1,33 @@ +extends Hitbox + +var enemy_exited: bool = false + +var direction: Vector2 = Vector2.ZERO +var knife_speed: int = 0 + + +func launch(initial_position: Vector2, dir: Vector2, speed: int) -> void: + position = initial_position + direction = dir + knockback_direction = dir + knife_speed = speed + + rotation += dir.angle() + PI/4 + + +func _physics_process(delta: float) -> void: + position += direction * knife_speed * delta + + +func _on_ThrowableKnike_body_exited(_body: KinematicBody) -> void: + if not enemy_exited: + enemy_exited = true + set_collision_mask_bit(0, true) + set_collision_mask_bit(1, true) + + +func _collide(body: KinematicBody2D) -> void: + if enemy_exited: + if body != null: + body.take_damage(damage, knockback_direction, knockback_force) + queue_free() diff --git a/Characters/Enemies/Goblin/ThrowableKnike.tscn b/Characters/Enemies/Goblin/ThrowableKnike.tscn new file mode 100644 index 0000000..cab9869 --- /dev/null +++ b/Characters/Enemies/Goblin/ThrowableKnike.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Characters/Enemies/Goblin/ThrowableKnike.gd" type="Script" id=1] +[ext_resource path="res://Art/v1.1 dungeon crawler 16x16 pixel pack/enemies/goblin/goblin_knife.png" type="Texture" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 1.41421 +height = 7.07107 + +[node name="ThrowableKnike" type="Area2D"] +collision_layer = 0 +collision_mask = 4 +script = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 0.785398 +shape = SubResource( 1 ) + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 2 ) + +[connection signal="body_exited" from="." to="." method="_on_ThrowableKnike_body_exited"] diff --git a/Characters/Hitbox.gd b/Characters/Hitbox.gd index 06e05c3..6943712 100644 --- a/Characters/Hitbox.gd +++ b/Characters/Hitbox.gd @@ -17,4 +17,11 @@ func _ready() -> void: func _on_body_entered(body: PhysicsBody2D) -> void: - body.take_damage(damage, knockback_direction, knockback_force) + _collide(body) + + +func _collide(body: KinematicBody2D) -> void: + if body == null or not body.has_method("take_damage"): + queue_free() + else: + body.take_damage(damage, knockback_direction, knockback_force) diff --git a/Game.gd b/Game.gd index 9c140b5..5b93e25 100644 --- a/Game.gd +++ b/Game.gd @@ -8,3 +8,8 @@ func _init() -> void: var window_size: Vector2 = OS.get_window_size() OS.set_window_position(screen_size * 0.5 - window_size * 0.5) + + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("ui_focus_next"): + get_tree().paused = true diff --git a/Rooms/Room.gd b/Rooms/Room.gd index a496f98..4f74055 100644 --- a/Rooms/Room.gd +++ b/Rooms/Room.gd @@ -3,7 +3,8 @@ extends Node2D const SPAWN_EXPLOSION_SCENE: PackedScene = preload("res://Characters/Enemies/SpawnExplosion.tscn") const ENEMY_SCENES: Dictionary = { - "FLYING_CREATURE": preload("res://Characters/Enemies/Flying Creature/FlyingCreature.tscn") + "FLYING_CREATURE": preload("res://Characters/Enemies/Flying Creature/FlyingCreature.tscn"), + "GOBLIN": preload("res://Characters/Enemies/Goblin/Goblin.tscn") } var num_enemies: int @@ -38,7 +39,11 @@ func _close_entrance() -> void: func _spawn_enemies() -> void: for enemy_position in enemy_positions_container.get_children(): - var enemy: KinematicBody2D = ENEMY_SCENES.FLYING_CREATURE.instance() + var enemy: KinematicBody2D + if randi() % 2 == 0: + enemy = ENEMY_SCENES.FLYING_CREATURE.instance() + else: + enemy = ENEMY_SCENES.GOBLIN.instance() var __ = enemy.connect("tree_exited", self, "_on_enemy_killed") enemy.position = enemy_position.position call_deferred("add_child", enemy) diff --git a/Rooms/SpawnRoom1.tscn b/Rooms/SpawnRoom1.tscn index 8864e8f..9ffb1fc 100644 --- a/Rooms/SpawnRoom1.tscn +++ b/Rooms/SpawnRoom1.tscn @@ -9,13 +9,13 @@ extents = Vector2( 32, 24 ) [node name="SpawnRoom1" instance=ExtResource( 1 )] [node name="TileMap" parent="." index="0"] -tile_data = PoolIntArray( 0, 7, 0, 1, 1, 0, 2, 1, 0, 3, 13, 0, 4, 14, 0, 5, 14, 0, 6, 12, 0, 7, 1, 0, 8, 1, 0, 9, 1, 0, 10, 1, 0, 11, 1, 0, 12, 1, 0, 13, 1, 0, 14, 1, 0, 15, 8, 0, 65536, 6, 0, 65537, 29, 0, 65538, 2, 0, 65539, 2, 0, 65540, 14, 0, 65541, 14, 0, 65542, 2, 0, 65543, 28, 0, 65544, 2, 0, 65545, 32, 0, 65546, 32, 0, 65547, 2, 0, 65548, 2, 0, 65549, 28, 0, 65550, 28, 0, 65551, 5, 0, 131072, 6, 0, 131073, 14, 0, 131074, 14, 0, 131075, 14, 0, 131076, 14, 0, 131077, 14, 0, 131078, 14, 0, 131079, 14, 0, 131080, 14, 0, 131081, 14, 0, 131082, 14, 0, 131083, 14, 0, 131084, 14, 0, 131085, 19, 0, 131086, 22, 0, 131087, 5, 0, 196608, 6, 0, 196609, 14, 0, 196610, 14, 0, 196611, 14, 0, 196612, 14, 0, 196613, 14, 0, 196614, 14, 0, 196615, 14, 0, 196616, 14, 0, 196617, 14, 0, 196618, 15, 0, 196619, 22, 0, 196621, 14, 0, 196622, 21, 0, 196623, 5, 0, 262144, 6, 0, 262145, 14, 0, 262146, 14, 0, 262147, 14, 0, 262148, 15, 0, 262149, 14, 0, 262150, 14, 0, 262151, 14, 0, 262152, 14, 0, 262153, 14, 0, 262154, 14, 0, 262155, 14, 0, 262156, 14, 0, 262157, 14, 0, 262158, 14, 0, 262159, 5, 0, 327680, 4, 0, 327681, 14, 0, 327682, 14, 0, 327683, 14, 0, 327684, 14, 0, 327685, 14, 0, 327686, 14, 0, 327687, 14, 0, 327688, 14, 0, 327689, 14, 0, 327690, 14, 0, 327691, 14, 0, 327692, 14, 0, 327693, 14, 0, 327694, 14, 0, 327695, 3, 0, 393220, 6, 0, 393221, 2, 0, 393222, 27, 0, 393223, 14, 0, 393224, 14, 0, 393225, 2, 0, 393226, 2, 0, 393227, 5, 0, 458756, 6, 0, 458757, 14, 0, 458758, 14, 0, 458759, 14, 0, 458760, 14, 0, 458761, 14, 0, 458762, 14, 0, 458763, 5, 0, 524292, 4, 0, 524293, 14, 0, 524294, 14, 0, 524295, 14, 0, 524296, 14, 0, 524297, 14, 0, 524298, 14, 0, 524299, 3, 0, 589829, 4, 0, 589830, 14, 0, 589831, 14, 0, 589832, 14, 0, 589833, 14, 0, 589834, 3, 0, 655366, 4, 0, 655367, 15, 0, 655368, 14, 0, 655369, 3, 0 ) +tile_data = PoolIntArray( 0, 7, 0, 1, 1, 0, 2, 1, 0, 3, 13, 0, 4, 14, 0, 5, 14, 0, 6, 12, 0, 7, 1, 0, 8, 1, 0, 9, 1, 0, 10, 1, 0, 11, 1, 0, 12, 1, 0, 13, 1, 0, 14, 1, 0, 15, 8, 0, 65536, 6, 0, 65537, 29, 0, 65538, 2, 0, 65539, 2, 0, 65540, 14, 0, 65541, 14, 0, 65542, 2, 0, 65543, 28, 0, 65544, 2, 0, 65545, 32, 0, 65546, 32, 0, 65547, 2, 0, 65548, 2, 0, 65549, 28, 0, 65550, 28, 0, 65551, 5, 0, 131072, 6, 0, 131073, 14, 0, 131074, 14, 0, 131075, 14, 0, 131076, 14, 0, 131077, 14, 0, 131078, 14, 0, 131079, 14, 0, 131080, 14, 0, 131081, 14, 0, 131082, 14, 0, 131083, 14, 0, 131084, 14, 0, 131085, 19, 0, 131086, 22, 0, 131087, 5, 0, 196608, 6, 0, 196609, 14, 0, 196610, 14, 0, 196611, 14, 0, 196612, 14, 0, 196613, 14, 0, 196614, 14, 0, 196615, 14, 0, 196616, 14, 0, 196617, 14, 0, 196618, 15, 0, 196621, 14, 0, 196622, 21, 0, 196623, 5, 0, 262144, 6, 0, 262145, 14, 0, 262146, 14, 0, 262147, 14, 0, 262148, 15, 0, 262149, 14, 0, 262150, 14, 0, 262151, 14, 0, 262152, 14, 0, 262153, 14, 0, 262154, 14, 0, 262155, 14, 0, 262156, 14, 0, 262157, 14, 0, 262158, 14, 0, 262159, 5, 0, 327680, 4, 0, 327681, 14, 0, 327682, 14, 0, 327683, 14, 0, 327684, 14, 0, 327685, 14, 0, 327686, 14, 0, 327687, 14, 0, 327688, 14, 0, 327689, 14, 0, 327690, 14, 0, 327691, 14, 0, 327692, 14, 0, 327693, 14, 0, 327694, 14, 0, 327695, 3, 0, 393220, 6, 0, 393221, 2, 0, 393222, 27, 0, 393223, 14, 0, 393224, 14, 0, 393225, 2, 0, 393226, 2, 0, 393227, 5, 0, 458756, 6, 0, 458757, 14, 0, 458758, 14, 0, 458759, 14, 0, 458760, 14, 0, 458761, 14, 0, 458762, 14, 0, 458763, 5, 0, 524292, 4, 0, 524293, 14, 0, 524294, 14, 0, 524295, 14, 0, 524296, 14, 0, 524297, 14, 0, 524298, 14, 0, 524299, 3, 0, 589829, 4, 0, 589830, 14, 0, 589831, 14, 0, 589832, 14, 0, 589833, 14, 0, 589834, 3, 0, 655366, 4, 0, 655367, 15, 0, 655368, 14, 0, 655369, 3, 0 ) [node name="TileMap2" parent="." index="1"] tile_data = PoolIntArray( 327681, 10, 0, 327682, 10, 0, 327683, 10, 0, 327684, 9, 0, 327685, 1, 0, 327686, 1, 0, 327687, 37, 0, 327688, 38, 0, 327689, 1, 0, 327690, 1, 0, 327691, 11, 0, 327692, 10, 0, 327693, 10, 0, 327694, 10, 0, 524293, 9, 0, 524298, 11, 0, 589830, 9, 0, 589833, 11, 0, 655367, 10, 0, 655368, 10, 0 ) [node name="FurnitureTileMap" parent="." index="2"] -tile_data = PoolIntArray( 196620, 25, 0, 393222, 33, 0, 393225, 33, 0 ) +tile_data = PoolIntArray( 196619, 26, 0, 196620, 25, 0, 393222, 33, 0, 393225, 33, 0 ) [node name="Door" parent="Doors" index="0" instance=ExtResource( 2 )] position = Vector2( 80, 16 )