add some enemy behavior prototypes
This commit is contained in:
27
godot/characters/enemies/blightwing/Blightwing.gd
Normal file
27
godot/characters/enemies/blightwing/Blightwing.gd
Normal 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)
|
@@ -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="."]
|
||||
|
Reference in New Issue
Block a user