Added locked barriers and a new ghost enemy

This commit is contained in:
VoidTwo
2021-12-04 18:23:05 -06:00
parent fcea3cee03
commit 9101bf2f65
21 changed files with 472 additions and 41 deletions

View File

@@ -0,0 +1,28 @@
extends Area2D
const SPEED: int = 35
var player_position: Vector2
var velocity: Vector2 = Vector2.ZERO
func init(spawn_position: Vector2, shoot_position: Vector2) -> void:
position = spawn_position
player_position = shoot_position
$Sprite.rotation = player_position.angle_to_point(position) + deg2rad(90)
return
func _physics_process(delta: float) -> void:
velocity = Vector2.ZERO
if position.distance_to(player_position) > 1:
velocity = position.direction_to(player_position).normalized() * SPEED * delta
position += velocity
return
func _on_tifetime_timeout() -> void:
call_deferred('queue_free')
return

View File

@@ -0,0 +1,41 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Sprites/Assets/Light.png" type="Texture" id=1]
[ext_resource path="res://Sprites/Enemies/Projectiles/Creepy_Hand.png" type="Texture" id=2]
[ext_resource path="res://Enemies/Projectiles/Creepy Hand.gd" type="Script" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 12.0
[node name="Creepy Hand" type="Area2D" groups=["enemy_hitbox"]]
light_mask = 0
scale = Vector2( 0.5, 0.5 )
collision_layer = 0
collision_mask = 2
input_pickable = false
monitoring = false
script = ExtResource( 3 )
[node name="Sprite" type="Sprite" parent="."]
light_mask = 0
texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
light_mask = 0
shape = SubResource( 1 )
[node name="Light" type="Light2D" parent="."]
texture = ExtResource( 1 )
texture_scale = 0.3
color = Color( 0.698039, 0.211765, 0.984314, 1 )
energy = 1.5
range_item_cull_mask = 15
shadow_item_cull_mask = 0
[node name="Lifetime" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
autostart = true
[connection signal="timeout" from="Lifetime" to="." method="_on_tifetime_timeout"]