Ghost enemy and other changes
This commit is contained in:
@@ -7,13 +7,15 @@
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 12.0
|
||||
|
||||
[node name="Creepy Hand" type="Area2D" groups=["enemy_projectile_1"]]
|
||||
[node name="Creepy Hand" type="Area2D" groups=[
|
||||
"enemy_projectile_1",
|
||||
]]
|
||||
light_mask = 0
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
input_pickable = false
|
||||
monitoring = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
23
Enemies/Projectiles/Fireball.gd
Normal file
23
Enemies/Projectiles/Fireball.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends Area2D
|
||||
|
||||
const SPEED: int = 200
|
||||
|
||||
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
|
||||
velocity = position.direction_to(player_position).normalized() * SPEED
|
||||
$Sprite.rotation = player_position.angle_to_point(position) + deg2rad(180)
|
||||
return
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
position += velocity * delta
|
||||
return
|
||||
|
||||
|
||||
func _on_Lifetime_timeout():
|
||||
call_deferred('queue_free')
|
80
Enemies/Projectiles/Fireball.tscn
Normal file
80
Enemies/Projectiles/Fireball.tscn
Normal file
@@ -0,0 +1,80 @@
|
||||
[gd_scene load_steps=15 format=2]
|
||||
|
||||
[ext_resource path="res://Enemies/Projectiles/Fireball.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Sprites/Enemies/Projectiles/Iceball_84x9.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 84, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 168, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 252, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 336, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=6]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 420, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=7]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 504, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=8]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 588, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=9]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 672, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=10]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 756, 0, 84, 63 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=11]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ) ],
|
||||
"loop": true,
|
||||
"name": "fire",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=12]
|
||||
height = 36.5213
|
||||
|
||||
[node name="Fireball" type="Area2D" groups=[
|
||||
"enemy_projectile_2",
|
||||
]]
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 11 )
|
||||
animation = "fire"
|
||||
frame = 7
|
||||
playing = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( -34.9228, -2.77795 )
|
||||
shape = SubResource( 12 )
|
||||
|
||||
[node name="Lifetime" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="Lifetime" to="." method="_on_Lifetime_timeout"]
|
Reference in New Issue
Block a user