Fixing merge conflicts

This commit is contained in:
Jasmine Hyder
2021-12-09 20:52:13 -06:00
100 changed files with 2347 additions and 537 deletions

View File

@@ -9,7 +9,7 @@ var speed : = 0.5
var position_tracker = 0.0
var player = null
var obstacle = null
var DisplayValue = 10
var DisplayValue = 5
var health: int = 2
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@@ -59,7 +59,7 @@ func _on_Star_detect_body_exited(_body):
#print("obstacle exited")
#if _body.name == 'Obstacle':
#obstacle = null
null
pass
func _on_Timer_timeout():
#print("time out")

View File

@@ -15,7 +15,9 @@ extents = Vector2( 5.48996, 5.06427 )
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 5.50204, 4.89798 )
[node name="Dark Matter" type="KinematicBody2D"]
[node name="Dark Matter" type="KinematicBody2D" groups=[
"enemy",
]]
collision_layer = 2
collision_mask = 6
script = ExtResource( 2 )
@@ -42,11 +44,13 @@ shape = SubResource( 3 )
[node name="Timer" type="Timer" parent="."]
[node name="Hitbox" type="Area2D" parent="."]
[node name="Dark_hitbox" type="Area2D" parent="." groups=[
"enemy_hitbox_1",
]]
collision_layer = 4
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Dark_hitbox"]
shape = SubResource( 4 )
[connection signal="body_entered" from="Player_detect" to="." method="_on_Player_detect_body_entered"]
@@ -54,4 +58,4 @@ shape = SubResource( 4 )
[connection signal="body_entered" from="Star_detect" to="." method="_on_Star_detect_body_entered"]
[connection signal="body_exited" from="Star_detect" to="." method="_on_Star_detect_body_exited"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="area_entered" from="Dark_hitbox" to="." method="_on_Hitbox_area_entered"]

74
Enemies/Demon Boss.gd Normal file
View File

@@ -0,0 +1,74 @@
extends KinematicBody2D
const SPEED: int = 30
var player: KinematicBody2D = null
var velocity: Vector2 = Vector2.ZERO
var health: int = 15
var hit: bool = false
var counter: int = 0
func _physics_process(_delta: float) -> void:
velocity = Vector2.ZERO
if player and position.distance_to(player.position) > 1:
velocity = position.direction_to(player.position).normalized() * SPEED
var angle = position.angle_to_point(player.position)
if abs(angle) > PI/2:
$AnimatedSprite1.scale.x = -0.563
else:
$AnimatedSprite1.scale.x = 0.563
if hit == true:
if counter < 15:
if counter % 5 == 0:
$AnimatedSprite1.visible = false
else:
$AnimatedSprite1.visible = true
counter += 1
velocity = Vector2.ZERO
else:
hit = false
counter = 0
velocity = move_and_slide(velocity)
return
func _on_player_detector_body_entered(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Walk'
return
func _on_player_detector_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = null
$AnimatedSprite1.animation = 'Idle'
return
func _on_hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group('player_weapon_1'):
health -= 1
hit = true
elif area.is_in_group('player_weapon_2'):
health -= 2
hit = true
if health <= 0:
call_deferred('queue_free')
return
func _on_Player_Detector__Attack_body_entered(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Attack'
func _on_Player_Detector__Attack_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Walk'

View File

@@ -1,347 +1,388 @@
[gd_scene load_steps=68 format=2]
[gd_scene load_steps=71 format=2]
[ext_resource path="res://Resources/Level_5_Enemy_Glowing_Ghost_Occluder.tres" type="OccluderPolygon2D" id=1]
[ext_resource path="res://Sprites/Assets/Light.png" type="Texture" id=2]
[ext_resource path="res://Sprites/Enemies/Demon_Slime_Spritesheet.png" type="Texture" id=3]
[ext_resource path="res://Enemies/DemonBoss.gd" type="Script" id=4]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 3 )
region = Rect2( 288, 0, 288, 160 )
[ext_resource path="res://Enemies/Demon Boss.gd" type="Script" id=4]
[ext_resource path="res://Sprites/Enemies/Demon_Slime_Spritesheet.png" type="Texture" id=5]
[ext_resource path="res://Sprites/Enemies/Chasing_Glowing_Ghost.png" type="Texture" id=7]
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 3 )
region = Rect2( 576, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 3 )
region = Rect2( 864, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 3 )
region = Rect2( 1152, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 3 )
region = Rect2( 1440, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 3 )
region = Rect2( 0, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 3 )
region = Rect2( 288, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 3 )
region = Rect2( 576, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 3 )
region = Rect2( 864, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 3 )
region = Rect2( 1152, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 3 )
region = Rect2( 1440, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=13]
atlas = ExtResource( 3 )
region = Rect2( 1728, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=14]
atlas = ExtResource( 3 )
region = Rect2( 2016, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=15]
atlas = ExtResource( 3 )
region = Rect2( 2304, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=16]
atlas = ExtResource( 3 )
region = Rect2( 2592, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=17]
atlas = ExtResource( 3 )
region = Rect2( 2880, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=18]
atlas = ExtResource( 3 )
region = Rect2( 3168, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=19]
atlas = ExtResource( 3 )
atlas = ExtResource( 5 )
region = Rect2( 0, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=20]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 5 )
region = Rect2( 288, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=21]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 5 )
region = Rect2( 576, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=22]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 5 )
region = Rect2( 864, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=23]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 5 )
region = Rect2( 1152, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=24]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 5 )
region = Rect2( 1440, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=25]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 5 )
region = Rect2( 1728, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=26]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 5 )
region = Rect2( 2016, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=27]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 5 )
region = Rect2( 2304, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=28]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 5 )
region = Rect2( 2592, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=29]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=13]
atlas = ExtResource( 5 )
region = Rect2( 2880, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=30]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=14]
atlas = ExtResource( 5 )
region = Rect2( 3168, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=31]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=15]
atlas = ExtResource( 5 )
region = Rect2( 3456, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=32]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=16]
atlas = ExtResource( 5 )
region = Rect2( 3744, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=33]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=17]
atlas = ExtResource( 5 )
region = Rect2( 4032, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=34]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=18]
atlas = ExtResource( 5 )
region = Rect2( 4320, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=35]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=19]
atlas = ExtResource( 5 )
region = Rect2( 4608, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=36]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=20]
atlas = ExtResource( 5 )
region = Rect2( 4896, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=37]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=21]
atlas = ExtResource( 5 )
region = Rect2( 5184, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=38]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=22]
atlas = ExtResource( 5 )
region = Rect2( 5472, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=39]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=23]
atlas = ExtResource( 5 )
region = Rect2( 5760, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=40]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=24]
atlas = ExtResource( 5 )
region = Rect2( 6048, 640, 288, 160 )
[sub_resource type="AtlasTexture" id=41]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=43]
atlas = ExtResource( 5 )
region = Rect2( 0, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=42]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=44]
atlas = ExtResource( 5 )
region = Rect2( 288, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=43]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=45]
atlas = ExtResource( 5 )
region = Rect2( 576, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=44]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=46]
atlas = ExtResource( 5 )
region = Rect2( 864, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=45]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=47]
atlas = ExtResource( 5 )
region = Rect2( 1152, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=46]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=48]
atlas = ExtResource( 5 )
region = Rect2( 1440, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=47]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=49]
atlas = ExtResource( 5 )
region = Rect2( 1728, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=48]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=50]
atlas = ExtResource( 5 )
region = Rect2( 2016, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=49]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=51]
atlas = ExtResource( 5 )
region = Rect2( 2304, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=50]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=52]
atlas = ExtResource( 5 )
region = Rect2( 2592, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=51]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=53]
atlas = ExtResource( 5 )
region = Rect2( 2880, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=52]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=54]
atlas = ExtResource( 5 )
region = Rect2( 3168, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=53]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=55]
atlas = ExtResource( 5 )
region = Rect2( 3456, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=54]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=56]
atlas = ExtResource( 5 )
region = Rect2( 3744, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=55]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=57]
atlas = ExtResource( 5 )
region = Rect2( 4032, 320, 288, 160 )
[sub_resource type="AtlasTexture" id=56]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=58]
atlas = ExtResource( 5 )
region = Rect2( 0, 480, 288, 160 )
[sub_resource type="AtlasTexture" id=57]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=59]
atlas = ExtResource( 5 )
region = Rect2( 288, 480, 288, 160 )
[sub_resource type="AtlasTexture" id=58]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=60]
atlas = ExtResource( 5 )
region = Rect2( 576, 480, 288, 160 )
[sub_resource type="AtlasTexture" id=59]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=61]
atlas = ExtResource( 5 )
region = Rect2( 864, 480, 288, 160 )
[sub_resource type="AtlasTexture" id=60]
atlas = ExtResource( 3 )
[sub_resource type="AtlasTexture" id=62]
atlas = ExtResource( 5 )
region = Rect2( 1152, 480, 288, 160 )
[sub_resource type="SpriteFrames" id=61]
[sub_resource type="AtlasTexture" id=25]
atlas = ExtResource( 5 )
region = Rect2( 0, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=26]
atlas = ExtResource( 5 )
region = Rect2( 288, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=27]
atlas = ExtResource( 5 )
region = Rect2( 576, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=28]
atlas = ExtResource( 5 )
region = Rect2( 864, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=29]
atlas = ExtResource( 5 )
region = Rect2( 1152, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=30]
atlas = ExtResource( 5 )
region = Rect2( 1440, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=31]
atlas = ExtResource( 5 )
region = Rect2( 1728, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=32]
atlas = ExtResource( 5 )
region = Rect2( 2016, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=33]
atlas = ExtResource( 5 )
region = Rect2( 2304, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=34]
atlas = ExtResource( 5 )
region = Rect2( 2592, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=35]
atlas = ExtResource( 5 )
region = Rect2( 2880, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=36]
atlas = ExtResource( 5 )
region = Rect2( 3168, 160, 288, 160 )
[sub_resource type="AtlasTexture" id=37]
atlas = ExtResource( 5 )
region = Rect2( 0, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=38]
atlas = ExtResource( 5 )
region = Rect2( 288, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=39]
atlas = ExtResource( 5 )
region = Rect2( 576, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=40]
atlas = ExtResource( 5 )
region = Rect2( 864, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=41]
atlas = ExtResource( 5 )
region = Rect2( 1152, 0, 288, 160 )
[sub_resource type="AtlasTexture" id=42]
atlas = ExtResource( 5 )
region = Rect2( 1440, 0, 288, 160 )
[sub_resource type="SpriteFrames" id=63]
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 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ) ],
"loop": true,
"name": "Walk",
"speed": 5.0
}, {
"frames": [ SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ), SubResource( 34 ), SubResource( 35 ), SubResource( 36 ), SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ) ],
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
"loop": true,
"name": "Death",
"speed": 5.0
}, {
"frames": [ SubResource( 41 ), SubResource( 42 ), SubResource( 43 ), SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ), SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ) ],
"frames": [ SubResource( 43 ), SubResource( 44 ), SubResource( 45 ), SubResource( 46 ), SubResource( 47 ), SubResource( 48 ), SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ), SubResource( 54 ), SubResource( 55 ), SubResource( 56 ), SubResource( 57 ) ],
"loop": true,
"name": "Attack",
"speed": 15.0
}, {
"frames": [ SubResource( 56 ), SubResource( 57 ), SubResource( 58 ), SubResource( 59 ), SubResource( 60 ) ],
"frames": [ SubResource( 58 ), SubResource( 59 ), SubResource( 60 ), SubResource( 61 ), SubResource( 62 ) ],
"loop": true,
"name": "Hit",
"speed": 5.0
}, {
"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ), SubResource( 34 ), SubResource( 35 ), SubResource( 36 ) ],
"loop": true,
"name": "Walk",
"speed": 5.0
}, {
"frames": [ SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ) ],
"loop": true,
"name": "Idle",
"speed": 5.0
} ]
[sub_resource type="CapsuleShape2D" id=62]
radius = 3.0
[sub_resource type="CapsuleShape2D" id=64]
radius = 1.5
height = 3.0
[sub_resource type="CapsuleShape2D" id=1]
radius = 26.0
height = 2.0
[sub_resource type="CircleShape2D" id=63]
radius = 50.0
[sub_resource type="CircleShape2D" id=2]
radius = 144.003
[node name="DemonBoss" type="KinematicBody2D" groups=[
"enemies",
]]
collision_layer = 2
[sub_resource type="CircleShape2D" id=65]
radius = 42.0
[node name="Demon Boss" type="KinematicBody2D" groups=["enemy"]]
light_mask = 0
collision_layer = 4
collision_mask = 5
script = ExtResource( 4 )
[node name="AnimatedSprite1" type="AnimatedSprite" parent="."]
position = Vector2( 1, -3 )
position = Vector2( 2, -15 )
scale = Vector2( 0.5, 0.5 )
frames = SubResource( 61 )
frames = SubResource( 63 )
animation = "Idle"
frame = 3
frame = 5
playing = true
[node name="Hitbox" type="CollisionShape2D" parent="."]
[node name="Sprite" type="Sprite" parent="."]
visible = false
light_mask = 4
position = Vector2( 0, -3 )
shape = SubResource( 62 )
texture = ExtResource( 7 )
offset = Vector2( 0, 0.5 )
[node name="Collision" type="CollisionShape2D" parent="."]
visible = false
light_mask = 0
rotation = 1.5708
shape = SubResource( 64 )
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox_1"]]
light_mask = 0
collision_layer = 4
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
visible = false
light_mask = 0
position = Vector2( 2, 5 )
shape = SubResource( 1 )
[node name="Player Detector" type="Area2D" parent="."]
input_pickable = false
monitorable = false
light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false
monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"]
scale = Vector2( 2, 2 )
shape = SubResource( 63 )
light_mask = 0
shape = SubResource( 2 )
[node name="Player Attack" type="Area2D" parent="."]
visible = false
input_pickable = false
monitorable = false
[node name="Player Detector - Attack" type="Area2D" parent="."]
light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false
monitorable = false
[node name="Attack" type="CollisionShape2D" parent="Player Attack"]
position = Vector2( 0, 7 )
scale = Vector2( 1, 0.75 )
shape = SubResource( 63 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector - Attack"]
shape = SubResource( 65 )
[node name="Light2D" type="Light2D" parent="."]
[node name="Player Detector - Attack2" type="Area2D" parent="."]
light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false
monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector - Attack2"]
visible = false
shape = SubResource( 65 )
[node name="Light" type="Light2D" parent="."]
visible = false
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 2 )
texture_scale = 0.5
color = Color( 0.984314, 0.94902, 0.211765, 0.392157 )
energy = 2.0
range_item_cull_mask = 11
[node name="Light2DEyes" type="Light2D" parent="."]
[node name="Eyes" type="Light2D" parent="."]
visible = false
scale = Vector2( 0.1, 0.1 )
texture = ExtResource( 2 )
offset = Vector2( 5, -40 )
offset = Vector2( 5, -35 )
range_item_cull_mask = 4
shadow_item_cull_mask = 0
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
[node name="Occluder" type="LightOccluder2D" parent="."]
visible = false
show_behind_parent = true
occluder = ExtResource( 1 )
[connection signal="area_entered" from="Player Detector" to="." method="_on_player_detector_area_entered"]
[connection signal="area_exited" from="Player Detector" to="." method="_on_player_detector_area_exited"]
[connection signal="area_entered" from="Player Attack" to="." method="_on_Player_Attack_area_entered"]
[connection signal="area_exited" from="Player Attack" to="." method="_on_Player_Attack_area_exited"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_hitbox_area_entered"]
[connection signal="body_entered" from="Player Detector" to="." method="_on_player_detector_body_entered"]
[connection signal="body_exited" from="Player Detector" to="." method="_on_player_detector_body_exited"]
[connection signal="body_entered" from="Player Detector - Attack" to="." method="_on_Player_Detector__Attack_body_entered"]
[connection signal="body_exited" from="Player Detector - Attack" to="." method="_on_Player_Detector__Attack_body_exited"]
[connection signal="body_entered" from="Player Detector - Attack2" to="." method="_on_Player_Detector__Attack_body_entered"]
[connection signal="body_exited" from="Player Detector - Attack2" to="." method="_on_Player_Detector__Attack_body_exited"]

View File

@@ -1,50 +0,0 @@
extends KinematicBody2D
const SPEED: int = 30
var player: KinematicBody2D = null
var velocity: Vector2 = Vector2.ZERO
var status = "walk"
func _physics_process(_delta: float) -> void:
velocity = Vector2.ZERO
if player:
velocity = position.direction_to(player.position).normalized() * SPEED
var angle = position.angle_to_point(player.position)
if abs(angle) > PI/2:
$AnimatedSprite1.scale.x = -0.563
else:
$AnimatedSprite1.scale.x = 0.563
velocity = move_and_slide(velocity)
return
func _on_player_detector_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
$AnimatedSprite1.animation = "Walk"
return
func _on_player_detector_area_exited(_area: Area2D):
player = null
$AnimatedSprite1.animation = "Idle"
return
func _on_Player_Attack_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
$AnimatedSprite1.animation = "Attack"
status = "attack"
return
func _on_Player_Attack_area_exited(area: Area2D) -> void:
player = null
if not status == "attack":
$AnimatedSprite1.animation = "Walk"
return

View File

@@ -4,6 +4,9 @@ const SPEED: int = 50
var player: KinematicBody2D = null
var velocity: Vector2 = Vector2.ZERO
var health: int = 2
var hit: bool = false
var counter: int = 0
func _physics_process(_delta: float) -> void:
@@ -30,21 +33,48 @@ func _on_player_detector_area_exited(_area: Area2D):
=======
velocity = Vector2.ZERO
if player:
if player and position.distance_to(player.position) > 1:
velocity = position.direction_to(player.position).normalized() * SPEED
if hit == true:
if counter < 15:
if counter % 5 == 0:
$AnimatedSprite.visible = false
else:
$AnimatedSprite.visible = true
counter += 1
velocity = Vector2.ZERO
else:
counter = 0
hit = false
velocity = move_and_slide(velocity)
return
func _on_player_detector_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
func _on_player_detector_body_entered(body: Node) -> void:
if body.is_in_group('player'):
player = body
return
func _on_player_detector_area_exited(_area: Area2D):
player = null
func _on_player_detector_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = null
return
func _on_hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group('player_weapon_1'):
health -= 1
hit = true
elif area.is_in_group('player_weapon_2'):
health -= 2
hit = true
if health <= 0:
call_deferred('queue_free')
return
>>>>>>> main

View File

@@ -1,106 +1,75 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Resources/Level_5_Enemy_Glowing_Ghost_Occluder.tres" type="OccluderPolygon2D" id=1]
[ext_resource path="res://Sprites/Assets/Light.png" type="Texture" id=2]
[ext_resource path="res://Sprites/Enemies/Chasing_Glowing_Ghost.png" type="Texture" id=3]
[ext_resource path="res://Enemies/Flaming Skull.gd" type="Script" id=4]
<<<<<<< HEAD
[ext_resource path="res://Sprites/Enemies/flaming skull design.png" type="Texture" id=5]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 5 )
region = Rect2( 0, 0, 672, 672 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 5 )
region = Rect2( 672, 0, 672, 672 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 5 )
region = Rect2( 1344, 0, 672, 672 )
[sub_resource type="SpriteFrames" id=4]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ) ],
=======
[ext_resource path="res://Sprites/Enemies/Flaming_Skull_Design.png" type="Texture" id=5]
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 0, 0, 672, 672 )
[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 672, 0, 672, 672 )
[sub_resource type="AtlasTexture" id=5]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 1344, 0, 672, 672 )
[sub_resource type="SpriteFrames" id=6]
animations = [ {
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
>>>>>>> main
"loop": true,
"name": "default",
"speed": 5.0
} ]
<<<<<<< HEAD
[sub_resource type="CapsuleShape2D" id=5]
radius = 3.0
height = 2.0
[sub_resource type="CircleShape2D" id=6]
radius = 50.0
[node name="Flaming Skull" type="KinematicBody2D" groups=[
"enemies",
]]
=======
[sub_resource type="CapsuleShape2D" id=1]
radius = 3.0
height = 2.0
radius = 5.0
height = 12.0
[sub_resource type="CircleShape2D" id=2]
radius = 50.0
[node name="Flaming Skull" type="KinematicBody2D" groups=["enemies"]]
>>>>>>> main
collision_layer = 2
[node name="Flaming Skull" type="KinematicBody2D" groups=["enemy"]]
light_mask = 0
collision_layer = 4
collision_mask = 5
script = ExtResource( 4 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
scale = Vector2( 0.0446429, 0.0446429 )
<<<<<<< HEAD
frames = SubResource( 4 )
frame = 1
=======
position = Vector2( 4.76837e-07, -2.38419e-07 )
scale = Vector2( 0.0517113, 0.0517113 )
frames = SubResource( 6 )
>>>>>>> main
frame = 2
playing = true
offset = Vector2( 0, 0.5 )
[node name="Hitbox" type="CollisionShape2D" parent="."]
[node name="Sprite" type="Sprite" parent="."]
visible = false
light_mask = 4
position = Vector2( 0, -3 )
<<<<<<< HEAD
shape = SubResource( 5 )
texture = ExtResource( 3 )
offset = Vector2( 0, 0.5 )
[node name="Player Detector" type="Area2D" parent="."]
input_pickable = false
monitorable = false
collision_layer = 0
[node name="Collision" type="CollisionShape2D" parent="."]
visible = false
light_mask = 0
rotation = 1.5708
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox_1"]]
light_mask = 0
collision_layer = 4
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"]
visible = false
shape = SubResource( 6 )
=======
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
light_mask = 0
position = Vector2( -1, 1 )
shape = SubResource( 1 )
[node name="Player Detector" type="Area2D" parent="."]
light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false
@@ -108,28 +77,9 @@ monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"]
visible = false
light_mask = 0
shape = SubResource( 2 )
>>>>>>> main
[node name="Light2D" type="Light2D" parent="."]
visible = false
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 2 )
color = Color( 0.984314, 0.94902, 0.211765, 0.392157 )
energy = 2.0
range_item_cull_mask = 11
[node name="Light2DEyes" type="Light2D" parent="."]
visible = false
scale = Vector2( 0.1, 0.1 )
texture = ExtResource( 2 )
offset = Vector2( 5, -40 )
range_item_cull_mask = 4
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
visible = false
show_behind_parent = true
occluder = ExtResource( 1 )
[connection signal="area_entered" from="Player Detector" to="." method="_on_player_detector_area_entered"]
[connection signal="area_exited" from="Player Detector" to="." method="_on_player_detector_area_exited"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_hitbox_area_entered"]
[connection signal="body_entered" from="Player Detector" to="." method="_on_player_detector_body_entered"]
[connection signal="body_exited" from="Player Detector" to="." method="_on_player_detector_body_exited"]

View File

@@ -4,12 +4,15 @@ const SPEED: int = 60
var player: KinematicBody2D = null
var velocity: Vector2 = Vector2.ZERO
var health: int = 2
var hit: bool = false
var counter: int = 0
func _physics_process(_delta: float) -> void:
velocity = Vector2.ZERO
if player:
if player and position.distance_to(player.position) > 1:
velocity = position.direction_to(player.position).normalized() * SPEED
var angle = position.angle_to_point(player.position)
if abs(angle) > PI/2:
@@ -17,31 +20,55 @@ func _physics_process(_delta: float) -> void:
else:
$AnimatedSprite1.scale.x = 0.563
if hit == true:
if counter < 15:
if counter % 5 == 0:
$AnimatedSprite1.visible = false
else:
$AnimatedSprite1.visible = true
counter += 1
velocity = Vector2.ZERO
else:
counter = 0
hit = false
velocity = move_and_slide(velocity)
return
func _on_player_detector_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
func _on_player_detector_body_entered(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Running'
return
func _on_player_detector_area_exited(_area: Area2D):
player = null
$AnimatedSprite1.animation = 'Idle'
func _on_player_detector_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = null
$AnimatedSprite1.animation = 'Idle'
return
func _on_Player_Attack_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
func _on_hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group('player_weapon_1'):
health -= 1
hit = true
elif area.is_in_group('player_weapon_2'):
health -= 2
hit = true
if health <= 0:
call_deferred('queue_free')
return
func _on_Player_Detector__Attack_body_entered(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Jump'
return
func _on_Player_Attack_area_exited(area: Area2D) -> void:
player = null
$AnimatedSprite1.animation = 'Running'
return
func _on_Player_Detector__Attack_body_exited(body: Node) -> void:
if body.is_in_group('player'):
player = body
$AnimatedSprite1.animation = 'Running'

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=2]
[gd_scene load_steps=30 format=2]
[ext_resource path="res://Resources/Level_5_Enemy_Glowing_Ghost_Occluder.tres" type="OccluderPolygon2D" id=1]
[ext_resource path="res://Sprites/Assets/Light.png" type="Texture" id=2]
@@ -7,181 +7,215 @@
[ext_resource path="res://Sprites/Enemies/Hell_Hound_Jump.png" type="Texture" id=5]
[ext_resource path="res://Sprites/Enemies/Hell_Hound_Run.png" type="Texture" id=6]
[sub_resource type="AtlasTexture" id=9]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=10]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 64, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=11]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 128, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=12]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 192, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=13]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 256, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=14]
flags = 4
atlas = ExtResource( 3 )
region = Rect2( 320, 0, 64, 32 )
[ext_resource path="res://Sprites/Enemies/Chasing_Glowing_Ghost.png" type="Texture" id=7]
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 0, 0, 65, 48 )
[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 65, 0, 65, 48 )
[sub_resource type="AtlasTexture" id=5]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 130, 0, 65, 48 )
[sub_resource type="AtlasTexture" id=6]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 195, 0, 65, 48 )
[sub_resource type="AtlasTexture" id=7]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 260, 0, 65, 48 )
[sub_resource type="AtlasTexture" id=8]
flags = 4
atlas = ExtResource( 5 )
region = Rect2( 325, 0, 65, 48 )
[sub_resource type="AtlasTexture" id=15]
flags = 4
atlas = ExtResource( 6 )
region = Rect2( 0, 0, 67, 32 )
[sub_resource type="AtlasTexture" id=16]
flags = 4
atlas = ExtResource( 6 )
region = Rect2( 67, 0, 67, 32 )
[sub_resource type="AtlasTexture" id=17]
flags = 4
atlas = ExtResource( 6 )
region = Rect2( 134, 0, 67, 32 )
[sub_resource type="AtlasTexture" id=18]
flags = 4
atlas = ExtResource( 6 )
region = Rect2( 201, 0, 67, 32 )
[sub_resource type="AtlasTexture" id=19]
flags = 4
atlas = ExtResource( 6 )
region = Rect2( 268, 0, 67, 32 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 3 )
region = Rect2( 0, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 3 )
region = Rect2( 64, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 3 )
region = Rect2( 128, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 3 )
region = Rect2( 192, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=13]
atlas = ExtResource( 3 )
region = Rect2( 256, 0, 64, 32 )
[sub_resource type="AtlasTexture" id=14]
atlas = ExtResource( 3 )
region = Rect2( 320, 0, 64, 32 )
[sub_resource type="SpriteFrames" id=20]
animations = [ {
"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ) ],
"loop": true,
"name": "Idle",
"speed": 3.0
}, {
<<<<<<< HEAD
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
=======
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ) ],
>>>>>>> main
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ) ]
"loop": true,
"name": "Jump",
"speed": 8.0
}, {
"frames": [ SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ) ],
"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ) ],
"loop": true,
"name": "Running",
"speed": 5.0
}, {
"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ) ],
"loop": true,
"name": "Idle",
"speed": 3.0
} ]
[sub_resource type="CapsuleShape2D" id=21]
radius = 1.5
height = 3.0
[sub_resource type="CapsuleShape2D" id=1]
radius = 3.0
radius = 8.0
height = 2.0
[sub_resource type="CircleShape2D" id=2]
radius = 50.0
radius = 82.0061
[sub_resource type="CircleShape2D" id=22]
radius = 25.02
[node name="Hellhound" type="KinematicBody2D" groups=["enemy"]]
light_mask = 0
collision_layer = 4
collision_mask = 5
[node name="Hellhound" type="KinematicBody2D" groups=["enemies"]]
collision_layer = 2
script = ExtResource( 4 )
[node name="AnimatedSprite1" type="AnimatedSprite" parent="."]
light_mask = 0
position = Vector2( 1, -3 )
scale = Vector2( 0.5625, 0.5625 )
frames = SubResource( 20 )
frames = SubResource( 18 )
animation = "Idle"
frame = 5
frame = 3
playing = true
[node name="Hitbox" type="CollisionShape2D" parent="."]
[node name="Sprite" type="Sprite" parent="."]
visible = false
light_mask = 4
position = Vector2( 0, -3 )
texture = ExtResource( 7 )
offset = Vector2( 0, 0.5 )
[node name="Collision" type="CollisionShape2D" parent="."]
visible = false
light_mask = 0
rotation = 1.5708
shape = SubResource( 21 )
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox_1"]]
light_mask = 0
collision_layer = 4
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
visible = false
light_mask = 0
shape = SubResource( 1 )
[node name="Player Detector" type="Area2D" parent="."]
light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false
monitorable = false
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector"]
visible = false
scale = Vector2( 1.5, 1.5 )
light_mask = 0
shape = SubResource( 2 )
[node name="Player Attack" type="Area2D" parent="."]
visible = false
[node name="Player Detector - Attack" type="Area2D" parent="."]
light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false
monitorable = false
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector - Attack"]
shape = SubResource( 22 )
[node name="Player Detector - Attack2" type="Area2D" parent="."]
light_mask = 0
collision_layer = 0
collision_mask = 2
input_pickable = false
monitorable = false
[node name="Attack" type="CollisionShape2D" parent="Player Attack"]
visible = false
scale = Vector2( 0.5, 0.5 )
shape = SubResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player Detector - Attack2"]
shape = SubResource( 22 )
[node name="Light2D" type="Light2D" parent="."]
[node name="Light" type="Light2D" parent="."]
visible = false
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 2 )
texture_scale = 0.5
color = Color( 0.984314, 0.94902, 0.211765, 0.392157 )
energy = 2.0
range_item_cull_mask = 11
[node name="Light2DEyes" type="Light2D" parent="."]
[node name="Eyes" type="Light2D" parent="."]
visible = false
scale = Vector2( 0.1, 0.1 )
texture = ExtResource( 2 )
offset = Vector2( 5, -40 )
offset = Vector2( 5, -35 )
range_item_cull_mask = 4
shadow_item_cull_mask = 0
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
[node name="Occluder" type="LightOccluder2D" parent="."]
visible = false
show_behind_parent = true
occluder = ExtResource( 1 )
[connection signal="area_entered" from="Player Detector" to="." method="_on_player_detector_area_entered"]
[connection signal="area_exited" from="Player Detector" to="." method="_on_player_detector_area_exited"]
[connection signal="area_entered" from="Player Attack" to="." method="_on_Player_Attack_area_entered"]
[connection signal="area_exited" from="Player Attack" to="." method="_on_Player_Attack_area_exited"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_hitbox_area_entered"]
[connection signal="body_entered" from="Player Detector" to="." method="_on_player_detector_body_entered"]
[connection signal="body_exited" from="Player Detector" to="." method="_on_player_detector_body_exited"]
[connection signal="body_entered" from="Player Detector - Attack" to="." method="_on_Player_Detector__Attack_body_entered"]
[connection signal="body_exited" from="Player Detector - Attack" to="." method="_on_Player_Detector__Attack_body_exited"]
[connection signal="body_entered" from="Player Detector - Attack2" to="." method="_on_Player_Detector__Attack_body_entered"]
[connection signal="body_exited" from="Player Detector - Attack2" to="." method="_on_Player_Detector__Attack_body_exited"]

18
Enemies/Snowball Blue.gd Normal file
View File

@@ -0,0 +1,18 @@
extends Area2D
var move = Vector2.ZERO
var look_vec = Vector2.ZERO
var player = null
var speed = 3
func _ready():
look_vec = player.position - global_position
func _physics_process(delta):
move = Vector2.ZERO
move = move.move_toward(look_vec, delta)
move = move.normalized() * speed
position += move

View File

@@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Enemies/Snowball.gd" type="Script" id=1]
[ext_resource path="res://Sprites/Enemies/blue_snowball.png" type="Texture" id=2]
[sub_resource type="CircleShape2D" id=1]
radius = 4.47823
[node name="snowball_blue" type="Area2D" groups=[
"freeze",
]]
collision_layer = 0
collision_mask = 2
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 0, -2 )
texture = ExtResource( 2 )
[node name="snowball_blue" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )

23
Enemies/Snowball.gd Normal file
View File

@@ -0,0 +1,23 @@
extends Area2D
var move = Vector2.ZERO
var look_vec = Vector2.ZERO
var player = null
var speed = 3
func _ready():
look_vec = player.position - position
func _physics_process(delta):
move = Vector2.ZERO
move = move.move_toward(look_vec, delta)
move = move.normalized() * speed
position += move
#position = position.move_toward(look_vec, delta).normalized() * SPEED

22
Enemies/Snowball.tscn Normal file
View File

@@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Enemies/Snowball.gd" type="Script" id=1]
[ext_resource path="res://Sprites/Enemies/pink_snowball.png" type="Texture" id=2]
[sub_resource type="CircleShape2D" id=1]
radius = 4.47823
[node name="snowball" type="Area2D" groups=[
"enemy_projectile_1",
]]
monitoring = false
collision_layer = 0
collision_mask = 2
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )
[node name="snowball" type="CollisionShape2D" parent="."]
position = Vector2( -0.00869751, -0.0361767 )
shape = SubResource( 1 )

View File

@@ -0,0 +1,64 @@
extends KinematicBody2D
onready var SNOWBALL_BLUE_SCENE = preload("res://Enemies/Snowball Blue.tscn")
var player = null
var move = Vector2.ZERO
var speed = .5
var health: int = 2
func _physics_process(delta: float) -> void:
move = Vector2.ZERO
if player != null:
move = position.direction_to(player.position) * speed
else:
move = Vector2.ZERO
move = move.normalized()
move = move_and_collide(move)
func _on_Area2D_body_entered(body: Node) -> void:
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = body
func _on_Area2D_body_exited(body: Node) -> void:
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = null
func fire():
var snowball = SNOWBALL_BLUE_SCENE.instance()
snowball.position = get_global_position()
snowball.player = player
get_parent().add_child(snowball)
$Timer.set_wait_time(1)
func _on_Timer_timeout() -> void:
if player != null:
fire()
func _on_player_detector_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
return
func _on_player_detector_area_exited(_area: Area2D):
player = null
return
func _on_hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group('player_weapon_1'):
health -= 1
elif area.is_in_group('player_weapon_2'):
health -= 2
if health <= 0:
call_deferred('queue_free')
return

View File

@@ -0,0 +1,54 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Sprites/Enemies/blue_snowman.png" type="Texture" id=1]
[ext_resource path="res://Enemies/Snowman Enemy.gd" type="Script" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 1.5
height = 3.0
[sub_resource type="CircleShape2D" id=2]
radius = 58.0175
[sub_resource type="CapsuleShape2D" id=3]
radius = 6.0
height = 5.0
[node name="snowmen_enemy" type="KinematicBody2D" groups=[
"freeze",
]]
collision_layer = 2
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
[node name="Collision" type="CollisionShape2D" parent="."]
light_mask = 0
position = Vector2( 0.618717, 6.27557 )
rotation = 1.5708
shape = SubResource( 1 )
[node name="detection" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="detection" type="CollisionShape2D" parent="detection"]
shape = SubResource( 2 )
[node name="Timer" type="Timer" parent="."]
autostart = true
[node name="hitbox" type="Area2D" parent="." groups=[
"freeze",
]]
collision_layer = 4
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"]
shape = SubResource( 3 )
[connection signal="body_entered" from="detection" to="." method="_on_Area2D_body_entered"]
[connection signal="body_exited" from="detection" to="." method="_on_Area2D_body_exited"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
[connection signal="area_entered" from="hitbox" to="." method="_on_hitbox_area_entered"]

66
Enemies/Snowman Enemy.gd Normal file
View File

@@ -0,0 +1,66 @@
extends KinematicBody2D
onready var SNOWBALL_SCENE = preload("res://Enemies/Snowball.tscn")
var player = null
var move = Vector2.ZERO
var speed = .5
var health: int = 2
func _physics_process(delta: float) -> void:
move = Vector2.ZERO
if player != null:
move = position.direction_to(player.position) * speed
else:
move = Vector2.ZERO
move = move.normalized()
move = move_and_collide(move)
func _on_Area2D_body_entered(body: Node) -> void:
if body != self && !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = body
func _on_Area2D_body_exited(body: Node) -> void:
if !(body.name.begins_with("tree")) && !(body.name.begins_with("snowmen_enemy")) && !(body.name.begins_with("wall")):
player = null
func fire():
var snowball = SNOWBALL_SCENE.instance()
snowball.position = get_global_position()
snowball.player = player
get_parent().add_child(snowball)
$Timer.set_wait_time(1)
func _on_Timer_timeout() -> void:
if player != null:
fire()
func _on_player_detector_area_entered(area: Area2D) -> void:
if area.get_parent().name == 'Player':
player = area.get_parent()
return
func _on_player_detector_area_exited(_area: Area2D):
player = null
return
func _on_hitbox_area_entered(area: Area2D) -> void:
print("HIT")
if area.is_in_group('player_weapon_1'):
health -= 1
elif area.is_in_group('player_weapon_2'):
health -= 2
if health <= 0:
call_deferred('queue_free')
return

View File

@@ -0,0 +1,55 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Sprites/Enemies/pink_snowman.png" type="Texture" id=1]
[ext_resource path="res://Enemies/Snowman Enemy.gd" type="Script" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 1.5
height = 3.0
[sub_resource type="CircleShape2D" id=2]
radius = 56.0659
[sub_resource type="CapsuleShape2D" id=3]
radius = 6.0
height = 5.0
[node name="snowmen_enemy" type="KinematicBody2D" groups=[
"enemy",
]]
collision_layer = 2
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
[node name="Collision" type="CollisionShape2D" parent="."]
light_mask = 0
position = Vector2( 0.618717, 6.27557 )
rotation = 1.5708
shape = SubResource( 1 )
[node name="detection" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="detection" type="CollisionShape2D" parent="detection"]
shape = SubResource( 2 )
[node name="Timer" type="Timer" parent="."]
autostart = true
[node name="hitbox" type="Area2D" parent="." groups=[
"enemy_hitbox_1",
]]
visible = false
collision_layer = 4
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"]
shape = SubResource( 3 )
[connection signal="body_entered" from="detection" to="." method="_on_Area2D_body_entered"]
[connection signal="body_exited" from="detection" to="." method="_on_Area2D_body_exited"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
[connection signal="area_entered" from="hitbox" to="." method="_on_hitbox_area_entered"]