enemy.gd 530 B

1234567891011121314151617181920212223242526272829
  1. extends Area2D
  2. export (int) var speed = 200
  3. var velocity = Vector2()
  4. func _ready():
  5. # Called when the node is added to the scene for the first time.
  6. # Initialization here
  7. pass
  8. func _process(delta):
  9. var speed_x = 1
  10. var speed_y = 0
  11. var motion = Vector2(-speed_x, speed_y) * speed
  12. set_position(get_global_position() + motion * delta)
  13. #func _process(delta):
  14. # # Called every frame. Delta is time since last frame.
  15. # # Update game logic here.
  16. # pass
  17. func _on_renemy_body_entered(body):
  18. queue_free()
  19. body.queue_free()