add some enemy behavior prototypes

This commit is contained in:
2022-07-21 00:05:08 -04:00
parent 31003a2863
commit 948f4ce911
20 changed files with 268 additions and 34 deletions

View File

@@ -0,0 +1,27 @@
extends KinematicBody2D
# Declare member variables here. Examples:
# var a: int = 2
# var b: String = "text"
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta: float) -> void:
var velocity = Vector2()
velocity.x += 1 * 50
#velocity.y -= 1 * 50
velocity = move_and_slide(velocity, Vector2(0, 0), true, 2)
for i in get_slide_count():
var collision = get_slide_collision(i)
#if collision.collider.name == "Player":
# print("Blightwing: " + String(OS.get_unix_time()) + " " + collision.collider.name)
func _on_Area2D_body_entered(body: Node) -> void:
print(body.name)

View File

@@ -25,14 +25,13 @@ animations = [ {
[sub_resource type="RectangleShape2D" id=5]
extents = Vector2( 5, 5 )
[node name="Blightwing" type="KinematicBody2D"]
[node name="Blightwing" type="KinematicBody2D" groups=["enemy"]]
collision_layer = 8
collision_mask = 11
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = SubResource( 4 )
animation = "fly"
frame = 1
playing = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]