From fce86322c78c2fdf126ebbf7a0dcbaaa05d59dc2 Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Wed, 11 Oct 2023 04:37:40 -0400 Subject: [PATCH] enemy occlusion --- Scenes/Levels/level_1.tscn | 4 ++-- Scenes/Spawnables/bat_spawnable.tscn | 2 +- Scenes/enemy.tscn | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Scenes/Levels/level_1.tscn b/Scenes/Levels/level_1.tscn index 075e004..d01a215 100644 --- a/Scenes/Levels/level_1.tscn +++ b/Scenes/Levels/level_1.tscn @@ -2,8 +2,8 @@ [ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"] [ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"] -[ext_resource type="PackedScene" uid="uid://dgtscjxcqoxls" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"] -[ext_resource type="PackedScene" uid="uid://cf7al5uln33rn" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"] +[ext_resource type="PackedScene" uid="uid://cl7w6ndvons1a" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"] +[ext_resource type="PackedScene" uid="uid://by2xmwcng01uy" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"] [ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"] [ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"] [ext_resource type="AudioStream" uid="uid://c3dy35dv368ft" path="res://Assets/Music/SisNeufPiDoozHuit.mp3" id="7_but47"] diff --git a/Scenes/Spawnables/bat_spawnable.tscn b/Scenes/Spawnables/bat_spawnable.tscn index 3678f16..5088354 100644 --- a/Scenes/Spawnables/bat_spawnable.tscn +++ b/Scenes/Spawnables/bat_spawnable.tscn @@ -10,7 +10,7 @@ region = Rect2(0, 0, 64, 64) [node name="BatSpawnable" instance=ExtResource("1_verf7")] maxHp = 10 -attackSpeed = 50.0 +attackSpeed = 20.0 speed = 4000.0 damage = 1 priority = 1 diff --git a/Scenes/enemy.tscn b/Scenes/enemy.tscn index 081b990..a93455f 100644 --- a/Scenes/enemy.tscn +++ b/Scenes/enemy.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=61 format=3 uid="uid://b5lnjonlf4i1b"] +[gd_scene load_steps=62 format=3 uid="uid://b5lnjonlf4i1b"] [ext_resource type="Script" path="res://Scripts/Enemy.gd" id="1_xj62t"] [ext_resource type="Texture2D" uid="uid://xn7yb3f5w17m" path="res://Assets/Knight/noBKG_KnightAttack_strip.png" id="2_dclcl"] @@ -11,6 +11,9 @@ [ext_resource type="AudioStream" uid="uid://dj7884l6tki3g" path="res://Assets/Audio/whoosh.ogg" id="8_ygdkj"] [ext_resource type="AudioStream" uid="uid://bmu622w5ea05y" path="res://Assets/Audio/mixkit-weak-fast-blow-2145.wav" id="9_myh6x"] +[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_xq5nx"] +polygon = PackedVector2Array(-2, 11, 2, 2, 2, -7, 0, -18, -5, -18, -6, -7, -6, 1) + [sub_resource type="AtlasTexture" id="AtlasTexture_6gjg8"] atlas = ExtResource("2_dclcl") region = Rect2(1296, 0, 144, 64) @@ -380,6 +383,9 @@ collision_layer = 5 collision_mask = 5 script = ExtResource("1_xj62t") +[node name="LightOccluder2D" type="LightOccluder2D" parent="."] +occluder = SubResource("OccluderPolygon2D_xq5nx") + [node name="Sprite" type="AnimatedSprite2D" parent="."] sprite_frames = SubResource("SpriteFrames_dqf8u") animation = &"Idle" @@ -449,6 +455,7 @@ position = Vector2(0, -3) shape = SubResource("CapsuleShape2D_p2hkm") [node name="AttackArea" type="Area2D" parent="."] +visible = false collision_layer = 2 collision_mask = 2