This repository has been archived on 2022-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
Tyra/scripts/Ennemi.gd

19 lines
431 B
GDScript3
Raw Normal View History

2021-04-03 23:47:20 +02:00
extends KinematicBody2D
var deplacement = Vector2()
func _ready():
pass
2021-04-07 18:15:55 +02:00
func _physics_process(_delta):
2021-04-03 23:47:20 +02:00
var Joueur = get_parent().get_node("Joueur") # récupère le joueur
position += (Joueur.position - position) / 50 # rapidité
look_at(Joueur.position) # regarde le joueur
2021-04-07 18:15:55 +02:00
move_and_collide(deplacement) # empeche la superposition des ennemis
2021-04-03 23:47:20 +02:00
func _on_Area2D_body_entered(body):
if "Balle" in body.name:
queue_free()